bug in ternary