Fix bugs in PacketSession.java