added error handling to TIFF reader