Fixes bug with escaping single quotes.

Also adds test case. See https://forums.aws.amazon.com/thread.jspa?threadID=100179
Merge pull request #4 from sp/master

Fixes bug with escaping single quotes