refine code of packet interface