diff --git a/poclu/misc.c b/poclu/misc.c
index db54260616b7ad57487497fce9ac6984c50e6154..35979db8359e198599bc3f23da811ead97f375be 100644
--- a/poclu/misc.c
+++ b/poclu/misc.c
@@ -111,10 +111,13 @@ poclu_get_any_device2 (cl_context *context, cl_device_id *device,
 }
 
 cl_int
-poclu_get_multiple_devices (cl_platform_id *platform, cl_context *context,
-                            cl_char include_custom_dev, cl_uint *num_devices,
-                            cl_device_id **devices, cl_command_queue **queues,
-                            int ooo_queues)
+poclu_get_multiple_devices (cl_platform_id *platform,
+                            cl_context *context,
+                            cl_char include_custom_dev,
+                            cl_uint *num_devices,
+                            cl_device_id **devices,
+                            cl_command_queue **queues,
+                            cl_command_queue_properties optional_props)
 {
   cl_int err;
   cl_uint num_dev_all = 0;
@@ -185,11 +188,13 @@ poclu_get_multiple_devices (cl_platform_id *platform, cl_context *context,
   if (err != CL_SUCCESS)
     goto ERROR;
 
-  cl_command_queue_properties props = CL_QUEUE_PROFILING_ENABLE;
-  if (ooo_queues)
-    props |= CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
   for (i = 0; i < *num_devices; ++i)
     {
+      cl_command_queue_properties dev_props = 0;
+      CHECK_CL_ERROR (clGetDeviceInfo (devs[i],
+                                       CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
+                                       sizeof (dev_props), &dev_props, NULL));
+      cl_command_queue_properties props = dev_props & optional_props;
       ques[i] = clCreateCommandQueue (*context, devs[i], props, &err);
       if (err != CL_SUCCESS)
         goto ERROR;
@@ -201,6 +206,11 @@ poclu_get_multiple_devices (cl_platform_id *platform, cl_context *context,
 
 ERROR:
   free (devs);
+  for (i = 0; i < *num_devices; ++i)
+    {
+      if (ques[i])
+        clReleaseCommandQueue (ques[i]);
+    }
   free (ques);
   return err;
 }
diff --git a/poclu/poclu.h b/poclu/poclu.h
index 904092a473c20dcbc73a855eaaeeb3d1ee36f47e..0c16d41861100467aaac3315b1c3019fa8580e2c 100644
--- a/poclu/poclu.h
+++ b/poclu/poclu.h
@@ -220,10 +220,14 @@ POCLU_API cl_int POCLU_CALL poclu_get_any_device (cl_context *context,
  * @return CL_SUCCESS on success, or a descriptive OpenCL error code upon
  * failure.
  */
-POCLU_API cl_int POCLU_CALL poclu_get_multiple_devices (
-    cl_platform_id *platform, cl_context *context, cl_char include_custom_dev,
-    cl_uint *num_devices, cl_device_id **devices, cl_command_queue **queues,
-    int ooo_queues);
+POCLU_API cl_int POCLU_CALL
+poclu_get_multiple_devices (cl_platform_id *platform,
+                            cl_context *context,
+                            cl_char include_custom_dev,
+                            cl_uint *num_devices,
+                            cl_device_id **devices,
+                            cl_command_queue **queues,
+                            cl_command_queue_properties optional_props);
 
 /**
  * Convert a float to a cl_half (uint16_t).
diff --git a/tests/runtime/test_buffer_migration.c b/tests/runtime/test_buffer_migration.c
index b7f41c9b15e6379cd05d38801f0ba93601413035..21299ef8a353fa5f7fafc14fe8ebb4fc49f87059 100644
--- a/tests/runtime/test_buffer_migration.c
+++ b/tests/runtime/test_buffer_migration.c
@@ -55,7 +55,8 @@ main (int argc, char **argv)
   cl_event ev1, ev2;
 
   err = poclu_get_multiple_devices (&platform, &context, 0, &num_devices,
-                                    &devices, &queues, 1);
+                                    &devices, &queues,
+                                    CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
   CHECK_OPENCL_ERROR_IN ("poclu_get_multiple_devices");
 
   printf ("NUM DEVICES: %u \n", num_devices);
diff --git a/tests/runtime/test_cl_pocl_content_size_migration.c b/tests/runtime/test_cl_pocl_content_size_migration.c
index 940b46fa289a156dedc6d33b89e81c8cee8fb8f5..c8907ae057770f17098dff4405f5203c299fb0a1 100644
--- a/tests/runtime/test_cl_pocl_content_size_migration.c
+++ b/tests/runtime/test_cl_pocl_content_size_migration.c
@@ -63,7 +63,7 @@ main (void)
   uint64_t content_size;
 
   poclu_get_multiple_devices (&platform, &context, CL_FALSE, &num_devices,
-                              &devices, &queues, CL_FALSE);
+                              &devices, &queues, 0);
   if (num_devices < 2)
     {
       printf ("Not enough devices (2 required), skipping");
diff --git a/tests/runtime/test_command_buffer.c b/tests/runtime/test_command_buffer.c
index 29280bb5c8f78ed0276fa2e32883bdcfbd117e0b..61009724d3648439aa2635d23ff41d016be3076c 100644
--- a/tests/runtime/test_command_buffer.c
+++ b/tests/runtime/test_command_buffer.c
@@ -118,8 +118,13 @@ main (int _argc, char **_argv)
   CHECK_CL_ERROR (
       clSetKernelArg (kernel, 2, sizeof (buffer_res), &buffer_res));
 
-  cl_command_queue command_queue = clCreateCommandQueue (
-      context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &error);
+  cl_command_queue_properties props = 0;
+  CHECK_CL_ERROR (clGetDeviceInfo (device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
+                                   sizeof (props), &props, NULL));
+  if (props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
+    props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
+  cl_command_queue command_queue
+    = clCreateCommandQueue (context, device, props, &error);
   CHECK_CL_ERROR (error);
 
   cl_command_buffer_khr command_buffer
diff --git a/tests/runtime/test_command_buffer_images.c b/tests/runtime/test_command_buffer_images.c
index 6656d089a1068b98fa289ed399a1463623333c46..a647292ed502d916b7052bc7488ef48a6e6cc4a3 100644
--- a/tests/runtime/test_command_buffer_images.c
+++ b/tests/runtime/test_command_buffer_images.c
@@ -116,8 +116,13 @@ main (int _argc, char **_argv)
                                &img_desc, NULL, &error);
   CHECK_CL_ERROR (error);
 
-  cl_command_queue command_queue = clCreateCommandQueue (
-      context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &error);
+  cl_command_queue_properties props = 0;
+  CHECK_CL_ERROR (clGetDeviceInfo (device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
+                                   sizeof (props), &props, NULL));
+  if (props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
+    props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
+  cl_command_queue command_queue
+    = clCreateCommandQueue (context, device, props, &error);
   CHECK_CL_ERROR (error);
 
   /**** Command buffer creation ****/