Fixed bug parent search function