optimize the packet code create class and fix some bug