Only return directories in listDirectories

Managed to introduce a small bug before