diff --git a/.editorconfig b/.editorconfig
index 26859949e2e06e1d5a5698869f5eec5316ad6959..cfe46c983ae82a7ad0b125178ef801d5e09f2267 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -13,4 +13,3 @@ trim_trailing_whitespace = false
 [*.yml]
 indent_style = spaces
 indent_size = 2
-
diff --git a/src/testbed.cu b/src/testbed.cu
index 4ba985c76c8a05c85a13ce0e5ebbad247aab1b83..c50d2694355ab7f2d6ece1621b3f1c422f4b756b 100644
--- a/src/testbed.cu
+++ b/src/testbed.cu
@@ -2902,7 +2902,7 @@ Testbed::Testbed(ETestbedMode mode) {
 			int gl_device = -1;
 			unsigned int device_count = 0;
 			if (cudaGLGetDevices(&device_count, &gl_device, 1, cudaGLDeviceListAll) == cudaSuccess) {
-				if (device_count > 0 && gl_device != -1) {
+				if (device_count > 0 && gl_device >= 0) {
 					set_cuda_device(gl_device);
 				}
 			}
@@ -2912,6 +2912,10 @@ Testbed::Testbed(ETestbedMode mode) {
 
 		glfwTerminate();
 	}
+
+	// Reset our stream, which was allocated on the originally active device,
+	// to make sure it corresponds to the now active device.
+	m_stream = {};
 #endif
 
 	int active_device = cuda_device();