using imageRecord, fixed error handling