Fix for crash when handling TCP packets