diff --git a/src/common/hattrie/hat-trie.c b/src/common/hattrie/hat-trie.c
index 0993635026a8421f096215e65fc2401b383d8afc..0c6b46ddb276ccd226149376831ac9433e370644 100644
--- a/src/common/hattrie/hat-trie.c
+++ b/src/common/hattrie/hat-trie.c
@@ -230,10 +230,6 @@ static inline node_ptr hattrie_find(node_ptr *parent, const char **key, size_t *
     return hattrie_find_ns(&parent, &sp, 0, key, len);
 }
 
-static inline value_t hattrie_setval(value_t v) {
-    return v;
-}
-
 /* initialize root node */
 static void hattrie_initroot(hattrie_t *T)
 {
@@ -321,9 +317,6 @@ hattrie_t* hattrie_dup(const hattrie_t* T, value_t (*nval)(value_t))
         return N;
     }
 
-    /* assignment */
-    if (!nval) nval = hattrie_setval;
-
     /*! \todo could be probably implemented faster */
 
     size_t l = 0;
diff --git a/src/knot/updates/ddns.c b/src/knot/updates/ddns.c
index b3ffdd71733c444c1e82bb45ac928a2bb98917fc..04a46f63389968d5b96c49a05c723b275c0d121d 100644
--- a/src/knot/updates/ddns.c
+++ b/src/knot/updates/ddns.c
@@ -373,7 +373,10 @@ static bool node_empty(const knot_node_t *node, knot_dname_t *owner,
 		knot_rrset_init(&node_rr, node->owner, node_rrset.type, KNOT_CLASS_IN);
 		for (uint16_t j = 0; j < node_rrset.rrs.rr_count; ++j) {
 			knot_rdata_t *add_rr = knot_rdataset_at(&node_rrset.rrs, j);
-			knot_rdataset_add(&node_rr.rrs, add_rr, NULL);
+			int ret = knot_rdataset_add(&node_rr.rrs, add_rr, NULL);
+			if (ret != KNOT_EOK) {
+				return false;
+			}
 			if (!removed_rr(changeset, &node_rr)) {
 				// One of the RRs from node was not removed.
 				knot_rdataset_clear(&node_rr.rrs, NULL);
@@ -708,8 +711,12 @@ static int process_rem_rr(const knot_rrset_t *rr,
 	                     rr->type == KNOT_RRTYPE_NS;
 	if (apex_ns) {
 		const knot_rdataset_t *ns_rrs = knot_node_rdataset(node, KNOT_RRTYPE_NS);
+		if (ns_rrs == NULL) {
+			// Zone without apex NS.
+			return KNOT_EOK;
+		}
 		if (*apex_ns_rem == ns_rrs->rr_count - 1) {
-			// Cannot remove last apex NS RR
+			// Cannot remove last apex NS RR.
 			return KNOT_EOK;
 		}
 	}