fix sql connection leaks