fixed the calculation of the  height