It sounds like it is doing exactly what the Gcode is telling it to do. Have you verified that? If not, you need to. Put it in single block and execute one line at the time. Read the line, understand what it is telling the machine to do, watch the machine. If the machine does something contrary to what the Gcode is telling it to do, tell us what that is.