Prevented race condition with the sets