Fix some problems found be the race detector.