diff --git a/compute/pzunmqr_param.c b/compute/pzunmqr_param.c
index 4b6696da40502a2a296c4d0c4a80d3a8481e08e1..923a3f8a73a5dc53f07804fe23e357d3ae14c708 100644
--- a/compute/pzunmqr_param.c
+++ b/compute/pzunmqr_param.c
@@ -391,7 +391,7 @@ void chameleon_pzunmqr_param( int genD, const libhqr_tree_t *qrtree,
             for (k = 0; k < K; k++) {
                 RUNTIME_iteration_push(chamctxt, k);
 
-                tempkn = k == B->nt-1 ? B->n-k*B->nb : B->nb;
+                tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb;
 
                 T = TS;
                 for (i = 0; i < qrtree->getnbgeqrf(qrtree, k); i++) {