cleanup loop and loop start