fixing height calculation bug