update to set content-type header and fix  toJSON image setter