Fixed race issue