BUG: premature db connection release