Fix layer visualization when the dataset is changed