fixed the global variable addressing issue