Fixing ternary cause it did not work