used old code to rebuild read packet