         		(const double*)sky->rel_n.data,
         		(double2*)K->ptr.data);
     }
+    else
+    {
+        return OSKAR_ERR_BAD_JONES_TYPE;
+    }
 
     cudaDeviceSynchronize();
     return cudaPeekAtLastError();

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

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

        		(const float*)sky->rel_n.data,
        		(float2*)K->ptr.data);
    }
    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;
