fixed up packet handling