fix multiple bugs in handling of unbalanced parens
fix another paren bug