Improved the code to get the label height.