How To Avoid Race Condition