Fixed some bugs calculing height