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 49bd793b2449248c736c623614dd68c794c66fc1)
@@ -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 49bd793b2449248c736c623614dd68c794c66fc1)
@@ -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 49bd793b2449248c736c623614dd68c794c66fc1)
@@ -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 49bd793b2449248c736c623614dd68c794c66fc1)
@@ -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));
 }
 
Index: uspace/srv/net/nil/nildummy/nildummy.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy.c	(revision 00d7e1bfe06501df61aed156666d5597397d910a)
+++ uspace/srv/net/nil/nildummy/nildummy.c	(revision 49bd793b2449248c736c623614dd68c794c66fc1)
@@ -136,5 +136,5 @@
 			device->mtu = NET_DEFAULT_MTU;
 		
-		printf("Device %d already exists:\tMTU\t= %zu\n", device->device_id,
+		printf("Device %d already exists (mtu: %zu)\n", device->device_id,
 		    device->mtu);
 		fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision 00d7e1bfe06501df61aed156666d5597397d910a)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 49bd793b2449248c736c623614dd68c794c66fc1)
@@ -753,5 +753,5 @@
 			return rc;
 		
-		rc = icmp_echo(icmp_id, icmp_seq, ICMP_GET_SIZE(*call),	
+		rc = icmp_echo(icmp_id, icmp_seq, ICMP_GET_SIZE(*call),
 		    ICMP_GET_TIMEOUT(*call), ICMP_GET_TTL(*call),
 		    ICMP_GET_TOS(*call), ICMP_GET_DONT_FRAGMENT(*call),
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision 00d7e1bfe06501df61aed156666d5597397d910a)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 49bd793b2449248c736c623614dd68c794c66fc1)
@@ -1651,5 +1651,4 @@
 	/* Sent packet? */
 	packet = pq_find(socket_data->outgoing, sequence_number);
-	printf("retransmit %lu\n", packet_get_id(packet));
 	if (packet) {
 		pq_get_order(packet, NULL, &data_length);
@@ -1790,5 +1789,4 @@
 
 			/* Send the packet */
-			printf("connecting %lu\n", packet_get_id(packet));
 			tcp_send_packets(socket_data->device_id, packet);
 
