fix misusing ternary operator