Found the cause! Limit switch Was disconnected at terminal.
But it was weird because instead of moving towards the limit switch the carriage was moving in opposite direction.
Also it appeared that a crash cauded the problem, but actually the open circuit must have been what caused the crash.