Index: uspace/lib/c/generic/net/packet.c
===================================================================
--- uspace/lib/c/generic/net/packet.c	(revision 00d7e1bfe06501df61aed156666d5597397d910a)
+++ uspace/lib/c/generic/net/packet.c	(revision e37eddc2f406d02077a9d309bfe9c4713d9ce771)
@@ -139,11 +139,13 @@
 packet_t *pm_find(packet_id_t packet_id)
 {
-	packet_t *packet;
 	if (!packet_id)
 		return NULL;
-
+	
 	fibril_rwlock_read_lock(&pm_globals.lock);
-	link_t *link =
-	    hash_table_find(&pm_globals.packet_map, &packet_id);
+	
+	unsigned long key = packet_id;
+	link_t *link = hash_table_find(&pm_globals.packet_map, &key);
+	
+	packet_t *packet;
 	if (link != NULL) {
 		pm_entry_t *entry =
@@ -172,5 +174,6 @@
 	
 	fibril_rwlock_write_lock(&pm_globals.lock);
-	pm_entry_t *entry = malloc(sizeof (pm_entry_t));
+	
+	pm_entry_t *entry = malloc(sizeof(pm_entry_t));
 	if (entry == NULL) {
 		fibril_rwlock_write_unlock(&pm_globals.lock);
@@ -179,7 +182,10 @@
 	
 	entry->packet = packet;
-	hash_table_insert(&pm_globals.packet_map, &packet->packet_id,
-	    &entry->link);
+	
+	unsigned long key = packet->packet_id;
+	hash_table_insert(&pm_globals.packet_map, &key, &entry->link);
+	
 	fibril_rwlock_write_unlock(&pm_globals.lock);
+	
 	return EOK;
 }
@@ -195,5 +201,8 @@
 	
 	fibril_rwlock_write_lock(&pm_globals.lock);
-	hash_table_remove(&pm_globals.packet_map, &packet->packet_id, 1);
+	
+	unsigned long key = packet->packet_id;
+	hash_table_remove(&pm_globals.packet_map, &key, 1);
+	
 	fibril_rwlock_write_unlock(&pm_globals.lock);
 }
Index: uspace/lib/c/include/net/packet.h
===================================================================
--- uspace/lib/c/include/net/packet.h	(revision 00d7e1bfe06501df61aed156666d5597397d910a)
+++ uspace/lib/c/include/net/packet.h	(revision e37eddc2f406d02077a9d309bfe9c4713d9ce771)
@@ -38,8 +38,10 @@
 #define LIBC_PACKET_H_
 
+#include <sys/types.h>
+
 /** Packet identifier type.
  * Value zero is used as an invalid identifier.
  */
-typedef unsigned long packet_id_t;
+typedef sysarg_t packet_id_t;
 
 /** Type definition of the packet.
@@ -51,5 +53,5 @@
  * @see packet_dimension
  */
-typedef struct packet_dimension	packet_dimension_t;
+typedef struct packet_dimension packet_dimension_t;
 
 /** Packet dimension. */
Index: uspace/lib/net/generic/packet_remote.c
===================================================================
--- uspace/lib/net/generic/packet_remote.c	(revision 00d7e1bfe06501df61aed156666d5597397d910a)
+++ uspace/lib/net/generic/packet_remote.c	(revision e37eddc2f406d02077a9d309bfe9c4713d9ce771)
@@ -115,5 +115,5 @@
 	
 	*packet = pm_find(packet_id);
-	if (!*packet) {
+	if (*packet == NULL) {
 		async_exch_t *exch = async_exchange_begin(sess);
 		sysarg_t size;
@@ -130,5 +130,5 @@
 	}
 	
-	if ((*packet)->next) {
+	if ((*packet != NULL) && ((*packet)->next)) {
 		packet_t *next;
 		return packet_translate_remote(sess, &next, (*packet)->next);
Index: uspace/lib/nic/src/nic_driver.c
===================================================================
--- uspace/lib/nic/src/nic_driver.c	(revision 00d7e1bfe06501df61aed156666d5597397d910a)
+++ uspace/lib/nic/src/nic_driver.c	(revision e37eddc2f406d02077a9d309bfe9c4713d9ce771)
@@ -671,5 +671,5 @@
 		}
 		fibril_rwlock_write_unlock(&nic_data->stats_lock);
-		nil_received_msg(nic_data->nil_session, pid, nic_data->device_id);
+		nil_received_msg(nic_data->nil_session, nic_data->device_id, pid);
 	} else {
 		switch (frame_type) {
@@ -703,7 +703,7 @@
 	nic_data->stats.receive_bytes += packet_get_data_length(packet);
 	fibril_rwlock_write_unlock(&nic_data->stats_lock);
-
-	nil_received_msg(nic_data->nil_session, packet_get_id(packet),
-		nic_data->device_id);
+	
+	nil_received_msg(nic_data->nil_session, nic_data->device_id,
+	    packet_get_id(packet));
 }
 
