raise exception when images are not right

Fixes #645