Fix crashes when getParent is null