spruce up error handling for null image bytes