fix bug: crashes when app sends malformed message length