Trying to fix the race condition in cluster code