Really fixed bug in closest_visible_ancestor

Previous fix was wrong.