Fix error handling when reading directory without permission