fixing file deletion bug