better error detection if image not OK