Index: /branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_catalog_split.c	(revision 38353)
+++ /branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_catalog_split.c	(revision 38354)
@@ -258,6 +258,8 @@
     
     // copies values but does not allocate new memory
-    gfits_copy_header_ptr (&rawheader, ftable->header);
-    gfits_copy_ftable_ptr (&rawtable, ftable);
+    Header *outheader = ftable->header;
+    gfits_copy_header_ptr (&rawheader, outheader);
+    gfits_copy_ftable_ptr (&rawtable, ftable); // this replaces ftable->header
+    ftable->header = outheader;
     *nativeOrder = TRUE;
   }
Index: /branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_convert.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_convert.c	(revision 38353)
+++ /branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_convert.c	(revision 38354)
@@ -109,5 +109,5 @@
 
   if (!strcmp (extname, "DVO_AVERAGE")) {
-    average = gfits_table_get_Average (ftable, Naverage, NULL, NULL);
+    average = gfits_table_get_Average (ftable, Naverage, NULL, &nativeBytes);
     if (!average) {
       fprintf (stderr, "ERROR: failed to read averages\n");
@@ -227,5 +227,5 @@
   if (!strcmp (extname, NAME)) {					\
     Measure_##TYPE *tmpMeasure;						\
-      tmpMeasure = gfits_table_get_Measure_##TYPE (ftable, Nmeasure, NULL, NULL); \
+      tmpMeasure = gfits_table_get_Measure_##TYPE (ftable, Nmeasure, NULL, &nativeBytes); \
 	if (!tmpMeasure) {						\
 	  fprintf (stderr, "ERROR: failed to read measures\n");		\
@@ -239,5 +239,5 @@
 
   if (!strcmp (extname, "DVO_MEASURE")) {
-    measure = gfits_table_get_Measure (ftable, Nmeasure, NULL, NULL);
+    measure = gfits_table_get_Measure (ftable, Nmeasure, NULL, &nativeBytes);
     if (!measure) {
       fprintf (stderr, "ERROR: failed to read measures\n");
@@ -332,5 +332,5 @@
   if (!strcmp (extname, NAME)) {					\
     Missing_##TYPE *tmpMissing;						\
-    tmpMissing = gfits_table_get_Missing_##TYPE (ftable, Nmissing, NULL, NULL); \
+    tmpMissing = gfits_table_get_Missing_##TYPE (ftable, Nmissing, NULL, &nativeBytes); \
     if (!tmpMissing) {							\
       fprintf (stderr, "ERROR: failed to read missing\n");		\
@@ -344,5 +344,5 @@
   // XXX the structure is here for future expansion, but no transformations are currently defined
   if (TRUE) {
-    missing = gfits_table_get_Missing (ftable, Nmissing, NULL, NULL);
+    missing = gfits_table_get_Missing (ftable, Nmissing, NULL, &nativeBytes);
     if (!missing) {
       fprintf (stderr, "ERROR: failed to read missing\n");
@@ -354,5 +354,5 @@
 
   if (!strcmp (extname, "DVO_MISSING")) {
-    missing = gfits_table_get_Missing (ftable, Nmissing, NULL, NULL);
+    missing = gfits_table_get_Missing (ftable, Nmissing, NULL, &nativeBytes);
     if (!missing) {
       fprintf (stderr, "ERROR: failed to read missing\n");
@@ -416,5 +416,5 @@
   if (!strcmp (extname, NAME)) { \
     SecFilt_##TYPE *tmpSecFilt; \
-    tmpSecFilt = gfits_table_get_SecFilt_##TYPE (ftable, Nsecfilt, NULL, NULL); \
+    tmpSecFilt = gfits_table_get_SecFilt_##TYPE (ftable, Nsecfilt, NULL, &nativeBytes); \
     if (!tmpSecFilt) { \
       fprintf (stderr, "ERROR: failed to read secfilts\n"); \
@@ -427,5 +427,5 @@
 
   if (!strcmp (extname, "DVO_SECFILT")) {
-    secfilt = gfits_table_get_SecFilt (ftable, Nsecfilt, NULL, NULL);
+    secfilt = gfits_table_get_SecFilt (ftable, Nsecfilt, NULL, &nativeBytes);
     if (!secfilt) {
       fprintf (stderr, "ERROR: failed to read secfilts\n");
@@ -510,5 +510,5 @@
   if (!strcmp (extname, "DVO_LENSING_PS1_V5") && (ftable[0].header[0].Naxis[0] == 128)) {
     Lensing_PS1_V5_R0 *tmpLensing;						
-    tmpLensing = gfits_table_get_Lensing_PS1_V5_R0 (ftable, Nlensing, NULL, NULL); 
+    tmpLensing = gfits_table_get_Lensing_PS1_V5_R0 (ftable, Nlensing, NULL, &nativeBytes); 
     if (!tmpLensing) {							
       fprintf (stderr, "ERROR: failed to read lensings\n");		
@@ -522,5 +522,5 @@
   if (!strcmp (extname, "DVO_LENSING_PS1_V5") && (ftable[0].header[0].Naxis[0] == 136)) {
     Lensing_PS1_V5_R1 *tmpLensing;						
-    tmpLensing = gfits_table_get_Lensing_PS1_V5_R1 (ftable, Nlensing, NULL, NULL); 
+    tmpLensing = gfits_table_get_Lensing_PS1_V5_R1 (ftable, Nlensing, NULL, &nativeBytes); 
     if (!tmpLensing) {							
       fprintf (stderr, "ERROR: failed to read lensings\n");		
@@ -534,5 +534,5 @@
   if (!strcmp (extname, "DVO_LENSING_PS1_V5") && (ftable[0].header[0].Naxis[0] == 144)) {
     Lensing_PS1_V5_R2 *tmpLensing;						
-    tmpLensing = gfits_table_get_Lensing_PS1_V5_R2 (ftable, Nlensing, NULL, NULL); 
+    tmpLensing = gfits_table_get_Lensing_PS1_V5_R2 (ftable, Nlensing, NULL, &nativeBytes); 
     if (!tmpLensing) {							
       fprintf (stderr, "ERROR: failed to read lensings\n");		
@@ -554,5 +554,5 @@
   if (!strcmp (extname, NAME)) {					\
     Lensing_##TYPE *tmpLensing;						\
-    tmpLensing = gfits_table_get_Lensing_##TYPE (ftable, Nlensing, NULL, NULL); \
+    tmpLensing = gfits_table_get_Lensing_##TYPE (ftable, Nlensing, NULL, &nativeBytes); \
     if (!tmpLensing) {							\
       fprintf (stderr, "ERROR: failed to read lensings\n");		\
@@ -565,5 +565,5 @@
 
   if (!strcmp (extname, "DVO_LENSING")) {
-    lensing = gfits_table_get_Lensing (ftable, Nlensing, NULL, NULL);
+    lensing = gfits_table_get_Lensing (ftable, Nlensing, NULL, &nativeBytes);
     if (!lensing) {
       fprintf (stderr, "ERROR: failed to read lensings\n");
@@ -649,5 +649,5 @@
   if (!strcmp (extname, "DVO_LENSOBJ_PS1_V5") && (ftable[0].header[0].Naxis[0] == 136)) {
     Lensobj_PS1_V5_R0 *tmpLensobj;						
-    tmpLensobj = gfits_table_get_Lensobj_PS1_V5_R0 (ftable, Nlensobj, NULL, NULL); 
+    tmpLensobj = gfits_table_get_Lensobj_PS1_V5_R0 (ftable, Nlensobj, NULL, &nativeBytes); 
     if (!tmpLensobj) {							
       fprintf (stderr, "ERROR: failed to read lensobjs\n");		
@@ -669,5 +669,5 @@
   if (!strcmp (extname, NAME)) {					\
     Lensobj_##TYPE *tmpLensobj;						\
-    tmpLensobj = gfits_table_get_Lensobj_##TYPE (ftable, Nlensobj, NULL, NULL); \
+    tmpLensobj = gfits_table_get_Lensobj_##TYPE (ftable, Nlensobj, NULL, &nativeBytes); \
     if (!tmpLensobj) {							\
       fprintf (stderr, "ERROR: failed to read lensobjs\n");		\
@@ -680,5 +680,5 @@
 
   if (!strcmp (extname, "DVO_LENSOBJ")) {
-    lensobj = gfits_table_get_Lensobj (ftable, Nlensobj, NULL, NULL);
+    lensobj = gfits_table_get_Lensobj (ftable, Nlensobj, NULL, &nativeBytes);
     if (!lensobj) {
       fprintf (stderr, "ERROR: failed to read lensobjs\n");
@@ -772,5 +772,5 @@
   if (!strcmp (extname, NAME)) {					\
     StarPar_##TYPE *tmpStarPar;						\
-    tmpStarPar = gfits_table_get_StarPar_##TYPE (ftable, Nstarpar, NULL, NULL); \
+    tmpStarPar = gfits_table_get_StarPar_##TYPE (ftable, Nstarpar, NULL, &nativeBytes); \
     if (!tmpStarPar) {							\
       fprintf (stderr, "ERROR: failed to read starpar\n");		\
@@ -783,5 +783,5 @@
 
   if (!strcmp (extname, "DVO_STARPAR")) {
-    starpar = gfits_table_get_StarPar (ftable, Nstarpar, NULL, NULL);
+    starpar = gfits_table_get_StarPar (ftable, Nstarpar, NULL, &nativeBytes);
     if (!starpar) {
       fprintf (stderr, "ERROR: failed to read starpar\n");
@@ -876,5 +876,5 @@
   if (!strcmp (extname, NAME)) {					\
     GalShape_##TYPE *tmpGalShape;						\
-    tmpGalShape = gfits_table_get_GalShape_##TYPE (ftable, Ngalshape, NULL, NULL); \
+    tmpGalShape = gfits_table_get_GalShape_##TYPE (ftable, Ngalshape, NULL, &nativeBytes); \
     if (!tmpGalShape) {							\
       fprintf (stderr, "ERROR: failed to read galshapes\n");		\
@@ -887,5 +887,5 @@
 
   if (!strcmp (extname, "DVO_GALSHAPE")) {
-    galshape = gfits_table_get_GalShape (ftable, Ngalshape, NULL, NULL);
+    galshape = gfits_table_get_GalShape (ftable, Ngalshape, NULL, &nativeBytes);
     if (!galshape) {
       fprintf (stderr, "ERROR: failed to read galshapes\n");
