improved connection management with wire protocol version check