Fix connection handling resulting in a null resultset