fix nested ternary