Fix ternary expression, more tests