fix bug due to operator precedence