Merge pull request #162 from csmith/master

Fix getConnection issues in debug plugin.
Tidy up some more getConnection calls.