added getAncestors, minor bug fixes