Fixed bugs with layerOptions