committing connection only if necessary