         		(const float*)sky->rel_n.data,
         		(float2*)K->ptr.data);
     }
-    else if (K->type() == OSKAR_DOUBLE_COMPLEX_MATRIX)
+    else if (K->type() == OSKAR_DOUBLE_COMPLEX)
     {
+        // Check that the data is of the right type.
+        if (sky->rel_l.type() != OSKAR_DOUBLE ||
+        		sky->rel_m.type() != OSKAR_DOUBLE ||
+        		sky->rel_n.type() != OSKAR_DOUBLE ||
+        		telescope->station_u.type() != OSKAR_DOUBLE ||
+        		telescope->station_v.type() != OSKAR_DOUBLE ||
+        		telescope->station_w.type() != OSKAR_DOUBLE ||
+        		telescope->station_x.type() != OSKAR_DOUBLE ||
+        		telescope->station_y.type() != OSKAR_DOUBLE ||
+        		telescope->station_z.type() != OSKAR_DOUBLE)
+            return OSKAR_ERR_TYPE_MISMATCH;
+
     	// Evaluate Greenwich Hour Angle of phase centre.
     	const double ha0 = gast - telescope->ra0;
     	const double dec0 = telescope->dec0;

        		(const double*)sky->rel_n.data,
        		(double2*)K->ptr.data);
    }

    cudaDeviceSynchronize();
    return cudaPeekAtLastError();

            telescope->station_z.location() != OSKAR_LOCATION_GPU)
        return OSKAR_ERR_BAD_LOCATION;

    // Get data sizes.
    const int n_sources  = K->n_sources();
    const int n_stations = K->n_stations();

    // Evaluate Jones matrix.
    if (K->type() == OSKAR_SINGLE_COMPLEX)
    {
        // Check that the data is of the right type.
        if (sky->rel_l.type() != OSKAR_SINGLE ||
        		sky->rel_m.type() != OSKAR_SINGLE ||
        		sky->rel_n.type() != OSKAR_SINGLE ||
