fix layerNumber < 0