fix multi threading bug. (variable initialization position)