switch image response type to JPG, since generated images are jpgs anyways; also expand error-catching cases
Merge branch 'master' into production