fixed bug with empty dirs