Height calculation bug fix