fixing bug in removeFolders