added external global variable support