reference global var properly