Fix bugs and do some debugging of the image and extractedimage models.