fixed some file delete code, added more debug alerts.