Fix in computing ancestors