fix wrong exception throws; fix connection release