Fix issue #6812: directory_mode does not work