fix packet mixing code