Fixed bug: files were not being deleted properly