Fix invalidated iterator