fixes for key escaping