added null checks after get Neighbor calls