Improving handling of dirty HEREDOCs