Avoiding race condition on assigning to @nodes