diff --git a/eg/q_eg b/eg/q_eg
old mode 100644
new mode 100755
diff --git a/eg/q_egtest b/eg/q_egtest
old mode 100644
new mode 100755
diff --git a/eg/q_test b/eg/q_test
old mode 100644
new mode 100755
diff --git a/src/Makefile.txt b/src/Makefile.txt
index e681a3bd545311647c2486df57d1152ff5e921ba..ab3cde443ca224999c1fc83e5f7ba8b73f654e42 100644
--- a/src/Makefile.txt
+++ b/src/Makefile.txt
@@ -63,10 +63,11 @@ CCOPTS2 = $(CCOPTS1)
 
 # OBJS in execution frequency order.  CFILES after libqhull.c are alphabetical
 OBJS = user.o global.o random.o stat.o io.o geom2.o poly2.o \
-       merge.o qhull.o geom.o poly.o qset.o mem.o
+       merge.o geom.o poly.o qset.o mem.o libqhull.o usermem.o userprintf.o \
+       rboxlib.o
 
 CFILES= unix.c libqhull.c geom.c geom2.c global.c io.c mem.c merge.c poly.c \
-        poly2.c random.c qset.c stat.c user.c qconvex.c qdelaun.c qhalf.c qvoronoi.c
+        poly2.c random.c qset.c stat.c user.c qconvex.c qdelaun.c qhalf.c qvoronoi.c usermem.c userprintf.c rboxlib.c
 HFILES= user.h libqhull.h qhull_a.h geom.h io.h mem.h merge.h poly.h random.h qset.h stat.h
 TXTFILES= ../Announce.txt ../REGISTER.txt ../COPYING.txt ../README.txt Changes.txt
 DOCFILES= ../html/rbox.txt ../html/qhull.txt
@@ -86,7 +87,7 @@ qconvex.o:   libqhull.h user.h mem.h
 qdelaun.o:   libqhull.h user.h mem.h
 qhalf.o:   libqhull.h user.h mem.h
 qvoronoi.o:   libqhull.h user.h mem.h
-qhull.o:  $(HFILES)
+libqhull.o:  $(HFILES)
 geom.o:   $(HFILES)
 geom2.o:  $(HFILES)
 global.o: $(HFILES)
@@ -177,8 +178,8 @@ qhullx: qconvex.o qdelaun.o qhalf.o qvoronoi.o unix.o $(OBJS)
 	-chmod +x ../eg/q_test ../eg/q_eg ../eg/q_egtest
 	-cd ..; ./rbox D4 | ./qhull
 
-rbox: rbox.o
-	$(CC) -o rbox rbox.o $(CCOPTS2) -lm
+rbox: rbox.o libqhull.a
+	$(CC) -o rbox rbox.o -L. -lqhull $(CCOPTS2) -lm
 	cp rbox ..
 
 user_eg: user_eg.o libqhull.a 
diff --git a/src/libqhull.h b/src/libqhull.h
index 43f0e9570c89bfa418e7c7947b6a63917c69d3b6..f9a909321a6b4849d4a51f892a5ae471bfb2678d 100644
--- a/src/libqhull.h
+++ b/src/libqhull.h
@@ -751,7 +751,7 @@ struct qhT {
   realT last_newhigh;
   unsigned lastreport;    /* for qh_buildtracing */
   int mergereport;        /* for qh_tracemerging */
-  void *old_qhstat;       /* for saving qh_qhstat in save_qhull() and UsingLibQhull.  Free with qh_free() */
+  qhstatT *old_qhstat;       /* for saving qh_qhstat in save_qhull() and UsingLibQhull.  Free with qh_free() */
   setT *old_tempstack;    /* for saving qhmem.tempstack in save_qhull */
   int   ridgeoutnum;      /* number of ridges for 4OFF output (qh_printbegin,etc) */
 };
diff --git a/src/mem.h b/src/mem.h
index b938c43d3cf61b8fa4aad3bf48fd8c495caeff7b..62ac64fc6cb3ca90b7fd1a7a8913981533c53a0f 100644
--- a/src/mem.h
+++ b/src/mem.h
@@ -115,7 +115,7 @@ struct qhmemT {               /* global memory management variables */
   void    *curbuffer;         /* current buffer, linked by offset 0 */
   void    *freemem;           /*   free memory in curbuffer */
   int 	   freesize;          /*   size of freemem in bytes */
-  void 	  *tempstack;         /* stack of temporary memory, managed by users */
+  setT 	  *tempstack;         /* stack of temporary memory, managed by users */
   FILE    *ferr;              /* file for reporting errors, only user is qh_fprintf() */
   int      IStracing;         /* =5 if tracing memory allocations */
   int      cntquick;          /* count of quick allocations */
diff --git a/src/rbox.c b/src/rbox.c
index 00b3b25dfa0aa2f5c2c575ec7ca161837e49fdd3..f1bb9d4b9955f53087c8727dd3ec9e38de6b5c56 100644
--- a/src/rbox.c
+++ b/src/rbox.c
@@ -93,5 +93,5 @@ int main(int argc, char **argv) {
     return_status= qh_ERRmem;
   }
   return return_status;
-}//main
+}/*main*/
 
diff --git a/src/rboxlib.c b/src/rboxlib.c
index a9bd5e1d760e245343f5684a76fcca039c44c783..02fd60ba2f75a34123c538ce47ed630aca1eb7d6 100644
--- a/src/rboxlib.c
+++ b/src/rboxlib.c
@@ -396,7 +396,7 @@ int qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command) {
 
   /* ============= simplex distribution =============== */
   if (issimplex+issimplex2) {
-    if (!(simplex= qh_malloc( dim * (dim+1) * sizeof(double)))) {
+    if (!(simplex= (double*)qh_malloc( dim * (dim+1) * sizeof(double)))) {
       qh_fprintf_rbox(rbox.ferr, 6196, "rbox error: insufficient memory for simplex\n");
       qh_errexit_rbox(qh_ERRmem); /* qh_ERRmem */
     }