Continue investigation to see where the problem is with the global variables.