Fix directory middleware to properly work with '.'