remove unmatched foldings