Fix SQL reconnection