Fix stencil layer problem