More fixes in ternary op sign handling