Fix for #ancestors ordering after rearranging tree, by means of adding #depth field