handle writing null image attributes
improve 404 error message