Smarter string escaping. Fixes #114