clean leaving the loop