Fix for releasing db connections properly