use safer method to set content-type