Fixing stencil output logic.