fix ternary parsing