Fixed behaviour of getAncestors method. Issue-4