Added safety when removing folders