The code works, but fails the tasks... Why?