diff --git a/src/knot/updates/xfr-in.c b/src/knot/updates/xfr-in.c
index f218ca07111f4e438f5cc152cfcae5c35dfd9525..100108d351fcac6be821c215465277e542c4f1c5 100644
--- a/src/knot/updates/xfr-in.c
+++ b/src/knot/updates/xfr-in.c
@@ -97,13 +97,16 @@ int xfrin_transfer_needed(const knot_zone_contents_t *zone,
 	 * Retrieve the remote Serial
 	 */
 	// the SOA should be the first (and only) RRSet in the response
-
 	const knot_pktsection_t *answer = knot_pkt_section(soa_response, KNOT_ANSWER);
-	if (answer->count < 1 || (&answer->rr[0])->type != KNOT_RRTYPE_SOA) {
+	if (answer->count < 1) {
+		return KNOT_EMALF;
+	}
+	knot_rrset_t soa_rr = answer->rr[0];
+	if (soa_rr.type != KNOT_RRTYPE_SOA) {
 		return KNOT_EMALF;
 	}
 
-	int64_t remote_serial = knot_rrs_soa_serial(&answer->rr[0].rrs);
+	int64_t remote_serial = knot_rrs_soa_serial(&soa_rr.rrs);
 	if (remote_serial < 0) {
 		return KNOT_EMALF;	// maybe some other error
 	}