Optimized listingDirectory(), fixed tests