Fix warnings and operator precedence on conditional statements