Fix the remove logic of StepIterator