Fix reading files and directories