fixed core dump when connection close.