fix ternary operator checking