fix looping of files done