fix generator exit