Fixes setRetry in Packet and cleans up code