Fixed ternary temp var issues