fix escaping of strings and add tests for backend bug