Fixed bugs with return/ternary