Fix handling of received packets