changed calc of plane params to improve robustness