Fixed root check bug in getParents