Make test for undefined nodes, Bug #2159.
Merge with Ram's changes for Bug #2159
Merging straight onto master, since there is a deadline.