avoiding race condition on assigning to @nodes
added missing docstring, and always returning a list of nodes
Merge pull request #792 from shatterednirvana/assign-nodes-correctly

Avoiding race condition on assigning to @nodes