Added packet integrity checks

This allows anything that might go wrong to be saved