diff --git a/lib/cache/entry_pkt.c b/lib/cache/entry_pkt.c
index bfbfce1e2ed176bad4d64b3d41fc8282dc313fbe..ad7bfea70434ef6746ac84f1b9da181e3c14ea47 100644
--- a/lib/cache/entry_pkt.c
+++ b/lib/cache/entry_pkt.c
@@ -210,15 +210,16 @@ int answer_from_pkt(kr_layer_t *ctx, knot_pkt_t *pkt, uint16_t type,
 	}
 
 	/* Finishing touches. TODO: perhaps factor out */
-	qry->flags.EXPIRING = is_expiring(eh->ttl, new_ttl);
-	qry->flags.CACHED = true;
-	qry->flags.NO_MINIMIZE = true;
-	qry->flags.DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
-	qry->flags.DNSSEC_BOGUS = kr_rank_test(eh->rank, KR_RANK_BOGUS);
-	if (qry->flags.DNSSEC_INSECURE || qry->flags.DNSSEC_BOGUS) {
-		qry->flags.DNSSEC_WANT = false;
+	struct kr_qflags * const qf = &qry->flags;
+	qf->EXPIRING = is_expiring(eh->ttl, new_ttl);
+	qf->CACHED = true;
+	qf->NO_MINIMIZE = true;
+	qf->DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
+	qf->DNSSEC_BOGUS = kr_rank_test(eh->rank, KR_RANK_BOGUS);
+	if (qf->DNSSEC_INSECURE || qf->DNSSEC_BOGUS) {
+		qf->DNSSEC_WANT = false;
 	}
-	qry->flags.DNSSEC_OPTOUT = eh->has_optout;
+	qf->DNSSEC_OPTOUT = eh->has_optout;
 	VERBOSE_MSG(qry, "=> satisfied by exact packet: rank 0%.2o, new TTL %d\n",
 			eh->rank, new_ttl);
 	return kr_ok();
diff --git a/lib/cache/peek.c b/lib/cache/peek.c
index 3bea5c3a98ae8352e3a87fbca2998df3f1c7e704..15f757ec8a425062b2adf3f1ab9e3fed55629271 100644
--- a/lib/cache/peek.c
+++ b/lib/cache/peek.c
@@ -285,10 +285,12 @@ int peek_nosync(kr_layer_t *ctx, knot_pkt_t *pkt)
 				? "+" : "-");
 	}
 	kr_log_verbose("\n");
+
 	/* Finishing touches. */
-	qry->flags.EXPIRING = expiring;
-	qry->flags.CACHED = true;
-	qry->flags.NO_MINIMIZE = true;
+	struct kr_qflags * const qf = &qry->flags;
+	qf->EXPIRING = expiring;
+	qf->CACHED = true;
+	qf->NO_MINIMIZE = true;
 
 	return KR_STATE_DONE;
 }
@@ -409,13 +411,15 @@ static int answer_simple_hit(kr_layer_t *ctx, knot_pkt_t *pkt, uint16_t type,
 	/* Put links to the materialized data into the pkt. */
 	ret = pkt_append(pkt, &ans.rrsets[AR_ANSWER], eh->rank);
 	CHECK_RET(ret);
+
 	/* Finishing touches. */
-	qry->flags.EXPIRING = is_expiring(eh->ttl, new_ttl);
-	qry->flags.CACHED = true;
-	qry->flags.NO_MINIMIZE = true;
-	qry->flags.DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
-	if (qry->flags.DNSSEC_INSECURE) {
-		qry->flags.DNSSEC_WANT = false;
+	struct kr_qflags * const qf = &qry->flags;
+	qf->EXPIRING = is_expiring(eh->ttl, new_ttl);
+	qf->CACHED = true;
+	qf->NO_MINIMIZE = true;
+	qf->DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
+	if (qf->DNSSEC_INSECURE) {
+		qf->DNSSEC_WANT = false;
 	}
 	VERBOSE_MSG(qry, "=> satisfied by exact %s: rank 0%.2o, new TTL %d\n",
 			(type == KNOT_RRTYPE_CNAME ? "CNAME" : "RRset"),