fix connection close issue and 'quit' compare