Fixed 2 paren-related bugs; added unit tests