updated exprTreeHelper to account for ~