copy correct amount of data _and_ generate new vectors
diff --git a/lib/fusion.c b/lib/fusion.c
index 7325391..f64df29 100644
--- a/lib/fusion.c
+++ b/lib/fusion.c
@@ -1013,21 +1013,21 @@
 
 ptls_fusion_aesgcm_context_t *ptls_fusion_aesgcm_set_capacity(ptls_fusion_aesgcm_context_t *ctx, size_t capacity)
 {
-    size_t ghash_cnt = aesgcm_calc_ghash_cnt(capacity);
+    size_t new_ghash_cnt = aesgcm_calc_ghash_cnt(capacity);
 
-    if (ghash_cnt <= ctx->ghash_cnt)
+    if (new_ghash_cnt <= ctx->ghash_cnt)
         return ctx;
 
-    size_t ctx_size = calc_aesgcm_context_size(&ghash_cnt, ctx->ecb.aesni256);
+    size_t new_ctx_size = calc_aesgcm_context_size(&new_ghash_cnt, ctx->ecb.aesni256);
     ptls_fusion_aesgcm_context_t *newp;
-    if ((newp = aligned_alloc(32, ctx_size)) == NULL)
+    if ((newp = aligned_alloc(32, new_ctx_size)) == NULL)
         return NULL;
-    memcpy(newp, ctx, ctx_size);
+    memcpy(newp, ctx, calc_aesgcm_context_size(&ctx->ghash_cnt, ctx->ecb.aesni256));
     free(ctx);
     ctx = newp;
 
     ctx->capacity = capacity;
-    while (ghash_cnt < ctx->ghash_cnt)
+    while (ctx->ghash_cnt < new_ghash_cnt)
         setup_one_ghash_entry(ctx);
 
     return ctx;