clean up for loop problems