fixes restoring connection on failed queries.