changed maxImageId back to Image.maximum("id")