Fix Issue #518: Full HTML support breaks optimization