Fixes bug in generic_dir_read()