Added checks when reading a file device.