I just had a similar issue and was using this:
if($modx->event->name == 'OnWebPagePrerender' AND $mime_in !== $mime_out)
{
$modx->resource->ContentType->set('mime_type', $mime_out);
}
This was causing other plugins that added CSS, JS etc to break as the content type isn't correct if your plugin isn't fired before the rest. Changing to
OnLoadWebDocument seems to have done the trick.
Thanks