Try to properly handle `get_node` failures. Fixes #386.
Break out of the loop in the proper place. Thanks @techhat.
Merge pull request #387 from s0undt3ch/issues/386

Try to properly handle `get_node` failures. Fixes #386.