Fix crash if adding sublayers via plugin interface