diff --git a/src/dnslib/node.c b/src/dnslib/node.c
index 6fb19b6dc9cbba7fb6e93fa326efa82348b8c525..5387c60701e16b3b4490d066623a126b398fcc02 100644
--- a/src/dnslib/node.c
+++ b/src/dnslib/node.c
@@ -22,8 +22,8 @@
 
 int compare_rrset_types( void *key1, void *key2 )
 {
-    return (*((uint8_t *)key1) == *((uint8_t *)key2) ? 
-    0 : *((uint8_t *)key1) < *((uint8_t *)key2) ? -1 : 1);
+    return (*((uint16_t *)key1) == *((uint16_t *)key2) ? 
+    0 : *((uint16_t *)key1) < *((uint16_t *)key2) ? -1 : 1);
 }
 
 dnslib_node_t *dnslib_node_new( dnslib_dname_t *owner, dnslib_node_t *parent )
diff --git a/src/tests/dnslib/dnslib_node_tests.c b/src/tests/dnslib/dnslib_node_tests.c
index f15a68476ad18b2b4dc1060ae77cf8fd45aefe5c..c9b01c5f48a2b0e0029fb55341a95ab119d2f6cb 100644
--- a/src/tests/dnslib/dnslib_node_tests.c
+++ b/src/tests/dnslib/dnslib_node_tests.c
@@ -153,10 +153,10 @@ static int test_node_sorting()
 
     node = skip_first(tmp->rrsets);
     
-    int last = *((int *)node->key);
+    int last = *((uint16_t *)node->key);
 
     while ((node = skip_next(node))!=NULL) {
-        if (last > *((int *)node->key)) {
+        if (last > *((uint16_t *)node->key)) {
             errors++;
             diag("RRset sorting error");
         }