Fix output of node by type map example
Fix some potential NullPointerException issues