improved handling of custom media types, unit tested current and new behaviour