fix auto code bug and update the packet code sample