modify getParentById method