Fixed core dump when protocol error.