fix error case on rmdir of file/dir