Fixed bugs with input escaping