Fixed string-escaping bug.
Fixed resource leak.