Index: trunk/ppTranslate/src/ppMopsMerge.c
===================================================================
--- trunk/ppTranslate/src/ppMopsMerge.c	(revision 28217)
+++ trunk/ppTranslate/src/ppMopsMerge.c	(revision 28218)
@@ -41,17 +41,17 @@
     for (int i = 0; i < numInputs; i++) {
         ppMopsDetections *det = detections->data[i]; // Detections from
+        if (!det || det->num == 0) {
+            continue;
+        }
         psVector *dupes = duplicates->data[i] = psVectorAlloc(det->num, PS_TYPE_U8);
         psVectorInit(dupes, 0);
         total += det->num;
     }
-
-    psVector *raMerged = psVectorAllocEmpty(total, PS_TYPE_F64); // Merged RAs
-    psVector *decMerged = psVectorAllocEmpty(total, PS_TYPE_F64); // Merged Decs
-#if 0
-    psVector *xMerged = psVectorAllocEmpty(total, PS_TYPE_F32);   // Merged x coords
-    psVector *yMerged = psVectorAllocEmpty(total, PS_TYPE_F32);   // Merged y coords
-#endif
-    psVector *sourceMerged = psVectorAllocEmpty(total, PS_TYPE_U16); // Source image of merged sources
-    psVector *indexMerged = psVectorAllocEmpty(total, PS_TYPE_U32); // Index of merged sources
+    psTrace("ppMops.merge", 2, "Total detections: %ld\n", total);
+
+    psVector *raMerged = psVectorAlloc(total, PS_TYPE_F64); // Merged RAs
+    psVector *decMerged = psVectorAlloc(total, PS_TYPE_F64); // Merged Decs
+    psVector *sourceMerged = psVectorAlloc(total, PS_TYPE_U16); // Source image of merged sources
+    psVector *indexMerged = psVectorAlloc(total, PS_TYPE_U32); // Index of merged sources
     long num = 0;                                                   // Number of merged sources
 
@@ -62,5 +62,5 @@
     double mjd = NAN;                           // Time of exposure
 
-    for (int i = 0; i < detections->n; i++) {
+    for (int i = 0; i < numInputs; i++) {
         ppMopsDetections *det = detections->data[i]; // Detections of interest
         if (!det) {
@@ -82,5 +82,4 @@
             alt = det->alt;
             az = det->az;
-            continue;
         } else {
             if (strcmp(raBoresight, det->raBoresight) != 0) {
@@ -132,6 +131,6 @@
 
         psTrace("ppMops.merge", 3, "Accepting %ld detections from input %d\n", det->num, i);
-        memcpy(&raMerged->data.F64[num], det->ra, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
-        memcpy(&decMerged->data.F64[num], det->dec, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
+        memcpy(&raMerged->data.F64[num], det->ra->data.F64, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
+        memcpy(&decMerged->data.F64[num], det->dec->data.F64, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
         for (long j = 0, k = num; j < det->num; j++, k++) {
             sourceMerged->data.U16[k] = i;
@@ -215,4 +214,5 @@
                 dupNum->data.U32[i]++;
             }
+            psFree(indices);
         }
         psFree(coords);
@@ -250,5 +250,7 @@
         psArray *table = psListToArray(det->table->list); // Table of data
         for (int j = 0; j < table->n; j++) {
-            psVector *vector = table->data[j]; // Vector to purge
+            psMetadataItem *item = table->data[j]; // Table item
+            psAssert(item->type == PS_DATA_VECTOR, "Table column is not a vector: %x", item->type);
+            psVector *vector = item->data.V; // Vector to purge
             switch (vector->type.type) {
                 VECTOR_PURGE_CASE(U8);
Index: trunk/ppTranslate/src/ppMopsRead.c
===================================================================
--- trunk/ppTranslate/src/ppMopsRead.c	(revision 28217)
+++ trunk/ppTranslate/src/ppMopsRead.c	(revision 28218)
@@ -68,6 +68,9 @@
         psFitsClose(fits);
 
-        det->ra = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "RA_PSF"));
-        det->dec = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "DEC_PSF"));
+        psVector *ra = psMetadataLookupVector(NULL, table, "RA_PSF");
+        psVector *dec = psMetadataLookupVector(NULL, table, "DEC_PSF");
+
+        det->ra = (psVector*)psBinaryOp(NULL, ra, "*", psScalarAlloc(DEG_TO_RAD(1.0), PS_TYPE_F64));
+        det->dec = (psVector*)psBinaryOp(NULL, dec, "*", psScalarAlloc(DEG_TO_RAD(1.0), PS_TYPE_F64));
         det->x = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "X_PSF"));
         det->y = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "Y_PSF"));
@@ -77,5 +80,5 @@
         }
 
-        psTrace("ppMops.read", 2, "Read %ld rows from %s\n", det->ra->n, (const char*)inNames->data[i]);
+        psTrace("ppMops.read", 2, "Read %ld rows from %s\n", det->num, (const char*)inNames->data[i]);
 
         detections->data[i] = det;
