fix no directories bug. add a test for it