Add fixes and tests for readdir