Fixed bug in removing files