fix heights computation

In the previous buggy form it was creating an overly conservative
approximation.