Fixing race condition in similarity analyzer.