fix globals racecondition