Index: src/sas/sascalc/calculator/c_extensions/librefl.c
===================================================================
--- src/sas/sascalc/calculator/c_extensions/librefl.c	(revision 4c29e4db880ce15b4400de7af0865fa99a32fe16)
+++ src/sas/sascalc/calculator/c_extensions/librefl.c	(revision a1daf86c0d7d0aba84e29d778ffd6148e933d93a)
@@ -7,5 +7,5 @@
 #include <stdio.h>
 #include <stdlib.h>
-#if defined(_MSC_VER)
+#if defined _MSC_VER  || defined __TINYCC__
 #define NEED_ERF
 #endif
@@ -21,5 +21,14 @@
 
 
-#ifdef _WIN32
+#ifdef __TINYCC__
+# ifdef isnan
+#   undef isnan
+# endif
+# ifdef isfinite
+#   undef isfinite
+# endif
+# define isnan(x) (x != x)
+# define isfinite(x) (x != INFINITY && x != -INFINITY)
+#elif defined _WIN32
 # include <float.h>
 # if !defined __MINGW32__ || defined __NO_ISOCEXT
@@ -30,6 +39,6 @@
 #   define isinf(x) (!_finite(x) && !_isnan(x))
 #  endif
-#  ifndef finite
-#   define finite(x) _finite(x)
+#  ifndef isfinite
+#   define isfinite(x) _finite(x)
 #  endif
 # endif
@@ -84,5 +93,5 @@
 double erf(double x)
 {
-    if (!finite(x)) {
+    if (!isfinite(x)) {
         if (isnan(x)) return x;      /* erf(NaN)   = NaN   */
         return (x>0 ? 1.0 : -1.0);   /* erf(+-inf) = +-1.0 */
@@ -94,5 +103,5 @@
 double erfc(double x)
 {
-    if (!finite(x)) {
+    if (!isfinite(x)) {
         if (isnan(x)) return x;      /* erfc(NaN)   = NaN      */
         return (x>0 ? 0.0 : 2.0);    /* erfc(+-inf) = 0.0, 2.0 */
Index: src/sas/sascalc/calculator/c_extensions/sld2i.c
===================================================================
--- src/sas/sascalc/calculator/c_extensions/sld2i.c	(revision 7e82256ecb32adc595227fc4ebf7d1d0f9c5e0c6)
+++ src/sas/sascalc/calculator/c_extensions/sld2i.c	(revision a1daf86c0d7d0aba84e29d778ffd6148e933d93a)
@@ -81,8 +81,9 @@
 		sumj_du = cassign(0.0, 0.0);
 		sumj_dd = cassign(0.0, 0.0);
-		//printf ("%d ", i);
+		//printf("i: %d\n", i);
 		//q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]); // + qz[i]*qz[i]);
 
 		for(j=0; j<this->n_pix; j++){
+			//printf("j: %d\n", j);
 			if (this->sldn_val[j]!=0.0
 				||this->mx_val[j]!=0.0
@@ -141,5 +142,5 @@
 		I_out[i] *= (1.0E+8 / count); //in cm (unit) / number; //to be multiplied by vol_pix
 	}
-	//printf ("count = %d %g %g %g %g\n", count, sldn_val[0],mx_val[0], my_val[0], mz_val[0]);
+	//printf("count = %d %g %g %g %g\n", count, this->sldn_val[0],this->mx_val[0], this->my_val[0], this->mz_val[0]);
 }
 /**
@@ -203,4 +204,4 @@
 		I_out[i] *= (1.0E+8 / count); //in cm (unit) / number; //to be multiplied by vol_pix
 	}
-	//printf ("count = %d %g %g %g %g\n", count, sldn_val[0],mx_val[0], my_val[0], mz_val[0]);
+	//printf("count = %d %g %g %g %g\n", count, sldn_val[0],mx_val[0], my_val[0], mz_val[0]);
 }
Index: src/sas/sascalc/calculator/c_extensions/sld2i_module.c
===================================================================
--- src/sas/sascalc/calculator/c_extensions/sld2i_module.c	(revision 7e82256ecb32adc595227fc4ebf7d1d0f9c5e0c6)
+++ src/sas/sascalc/calculator/c_extensions/sld2i_module.c	(revision a1daf86c0d7d0aba84e29d778ffd6148e933d93a)
@@ -71,4 +71,5 @@
 	GenI* sld2i;
 
+	//printf("new GenI\n");
 	if (!PyArg_ParseTuple(args, "iOOOOOOOOddd", &is_avg, &x_val_obj, &y_val_obj, &z_val_obj, &sldn_val_obj, &mx_val_obj, &my_val_obj, &mz_val_obj, &vol_pix_obj, &inspin, &outspin, &stheta)) return NULL;
 	INVECTOR(x_val_obj, x_val, n_x);
@@ -104,4 +105,5 @@
 	GenI* sld2i;
 
+	//printf("in genicom_inputXY\n");
 	if (!PyArg_ParseTuple(args, "OOOO",  &gen_obj, &qx_obj, &qy_obj, &I_out_obj)) return NULL;
 	sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI");
@@ -109,4 +111,5 @@
 	INVECTOR(qy_obj, qy, n_qy);
 	OUTVECTOR(I_out_obj, I_out, n_out);
+	//printf("qx, qy, I_out: %d %d %d, %d %d %d\n", qx, qy, I_out, n_qx, n_qy, n_out);
 
 	// Sanity check
@@ -114,4 +117,5 @@
 
 	genicomXY(sld2i, (int)n_qx, qx, qy, I_out);
+	//printf("done calc\n");
 	//return PyCObject_FromVoidPtr(s, del_genicom);
 	return Py_BuildValue("i",1);
Index: src/sas/sascalc/calculator/sas_gen.py
===================================================================
--- src/sas/sascalc/calculator/sas_gen.py	(revision f926abb325187de7b30539bc43c111eef4238011)
+++ src/sas/sascalc/calculator/sas_gen.py	(revision a1daf86c0d7d0aba84e29d778ffd6148e933d93a)
@@ -143,5 +143,7 @@
             qx, qy = _vec(qx), _vec(qy)
             I_out = np.empty_like(qx)
+            #print("npoints", qx.shape, "npixels", pos_x.shape)
             mod.genicomXY(model, qx, qy, I_out)
+            #print("I_out after", I_out)
         else:
             qx = _vec(qx)
@@ -1112,8 +1114,9 @@
     model.set_sld_data(omf2sld.output)
     x = np.linspace(0, 0.1, 11)[1:]
-    model.runXY([x, x])
+    return model.runXY([x, x])
 
 if __name__ == "__main__":
     #test_load()
     #test_save()
+    #print(test())
     test()
