more fixes to flag-based escaping