another small improvement to parent detection