Fixed global variable issue with height