Improve unmatched bracket handling