safer content-type parsing