             if(preInt)
             {
                 const float sb = volume(vidx, line-iPosY, slice, principal);
-                if(slice != firstSlice)
+                if(sf >= 0.f)
                 {
                     const float4 c = tex2D(tex_preint, sf, sb);
 

    // initialise intermediate image line
    extern __shared__ char smem[];
    Pixel *imgLine = (Pixel *)smem;
    Scalar *sf = (Scalar *)&imgLine[width*preInt];

    for (int ix=threadIdx.x; ix<width; ix+=blockDim.x)
    {
        initPixel(&imgLine[ix]);
        if(preInt)
            sf[ix] = 0.f;
    }

    // composite slices for this image line

    {
        Pixel d;
        initPixel(&d);
        float sf = -1.f;

        // composite slices for this image line
        for (int slice=firstSlice; slice!=lastSlice; slice += sliceStep)
