Having issues with the ternary code