ternary operations patch