             const auto g2 = sigmoidf(u2 + wc2*cur + bias2);
             cur = (cur-u0)*g1 + u0;
             const auto val = calc_activation(activation_type, cur);
-            *hp = skip_type ? ((val * mask - x_val) * g2 + x_val) : (val * mask * g2);
+            *hp = skip_type ? ((val - x_val) * mask * g2 + x_val) : (val * mask * g2);
         } 
         //else {
         //    *hp = 0;  // output 0 for a pad token

 
            // gradient with respect to x[t]
            if (skip_type)
                *gxp = gh_val*(1.f-g2);           
        }

        up -= ncols_u;

            const auto g2 = sigmoidf(u2 + wc2*cur + bias2);
            cur = (cur-u0)*g1 + u0;
            const auto val = calc_activation(activation_type, cur);
            *hp = skip_type ? ((val - x_val) * mask * g2 + x_val) : (val * mask * g2);
        } 
        //else {
        //    *hp = 0;  // ouptut 0 for a pad token
