You also need to first check if the parent is not null