Replace mistakenly removed brackets, close unmatched parenthesis