Fixed issue with getDirs function