fixes for permalink and the case where visibleLayers is top-most parent layer