Fixed bug due to operator precedence