Fix crash handling a request for a directory