added a rmdir on empty directories