Check for existence of parent and parent-parent node before accessing it