Fix ternary operator issue