fixed problem with global variable declaration