fix error code for read on a directory