Bug fixes for mean plane calculation