memory leak caused by using multiple equations with parentheses