fixed racecondition