Reduce chance of null pointer exception in race condition.