fix bug MoveBackward & MoveForward when stack is empty