Is there any reason why the priority of your
wp_head filter has to be set to
999999? This seems to me to be unreasonably high. I recently did some buffer modification to change some of the code in the plugin but had to set the priority higher than your current level.
Would you think about making the priority lower? Say,