Global variable issue