Fixed the rewinding logic.