fixed some file bugs with the clean up process