Fixed bug in operator precedence and slope calculation