diff --git a/CMakeLists.txt b/CMakeLists.txt
index d570cb074878d11155d2748985fdabb570ec244d..305de41d0915e15620708173c25fe82a38e49d0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -189,7 +189,7 @@ if (VegaFEM_BUILD_MODEL_REDUCTION)
   endif()
 endif()
 
-if (VegaFEM_ENABLE_OpenGL_SUPPORT)
+if (VegaFEM_ENABLE_OpenGL_SUPPORT AND VegaFEM_BUILD_UTILITIES)
   if(NOT GLUI_INCLUDE_DIR OR NOT GLUI_LIBRARY)
     add_subdirectory(thirdparty/glui/2.36/src)
     set(GLUI_LIBRARY glui)
@@ -281,7 +281,7 @@ set(ConfigPackageLocation lib/cmake/VegaFEM)
 install(EXPORT VegaFEMTargets
   FILE
     VegaFEMTargets.cmake
-    #NAMESPACE VegaFEM::
+    NAMESPACE VegaFEM::
   DESTINATION
     ${ConfigPackageLocation}
 )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b3e89d5c2e9b1b82e01a54f6cfc364a09d110349..e4519396cf0d2f9bfb49cdaf398786ffbb99b2e8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,6 +2,6 @@ foreach(mod ${VegaFEM_Modules})
   add_subdirectory(lib${mod})
 endforeach()
 
-if(BUILD_UTILITIES)
+if(VegaFEM_BUILD_UTILITIES)
   add_subdirectory(util)
-endif(BUILD_UTILITIES)
+endif(VegaFEM_BUILD_UTILITIES)
diff --git a/src/libminivector/mat3d.h b/src/libminivector/mat3d.h
index 3e8b1539de0ee1f36070d17a93022161f761ab33..7238166bcf97b7bd63a9a63ba7d24f1b428a50cc 100644
--- a/src/libminivector/mat3d.h
+++ b/src/libminivector/mat3d.h
@@ -48,7 +48,7 @@
 
 class Mat3d {
 public:
-  
+
   inline Mat3d() {}
 
   /*
@@ -60,7 +60,7 @@ public:
                double x3, double x4, double x5,
                double x6, double x7, double x8);
   inline Mat3d(double mat[9]); // "mat" must be given in row-major order
-  inline Mat3d(Vec3d rows[3]); 
+  inline Mat3d(Vec3d rows[3]);
   inline Mat3d(Vec3d row0, Vec3d row1, Vec3d row2);
   inline Mat3d(double diag); // create a diagonal matrix with all entries "diag" (can create zero matrix by passing 0.0)
 
@@ -69,7 +69,7 @@ public:
 		  double x6, double x7, double x8);
   inline void set(double value); // set all elements to value
 
-  inline Mat3d & operator=(const Mat3d & source); 
+  inline Mat3d & operator=(const Mat3d & source);
 
   inline Mat3d operator+ (const Mat3d & );
   inline Mat3d & operator+= (const Mat3d & );
@@ -147,7 +147,7 @@ inline Mat3d::Mat3d(double mat[9])
   elt[2] = Vec3d(mat[6],mat[7],mat[8]);
 }
 
-inline Mat3d::Mat3d(Vec3d rows[3]) 
+inline Mat3d::Mat3d(Vec3d rows[3])
 {
   elt[0] = rows[0];
   elt[1] = rows[1];
@@ -187,7 +187,7 @@ inline void Mat3d::set(double x0, double x1, double x2,
 
 inline void Mat3d::set(double value)
 {
-  elt[0][0] = elt[0][1] = elt[0][2] = 
+  elt[0][0] = elt[0][1] = elt[0][2] =
   elt[1][0] = elt[1][1] = elt[1][2] =
   elt[2][0] = elt[2][1] = elt[2][2] = value;
 }
@@ -302,7 +302,7 @@ inline Mat3d operator/ (double scalar, const Mat3d & mat2)
 
   return result;
 }
- 
+
 inline Mat3d tensorProduct(Vec3d & vecA, Vec3d & vecB)
 {
   Mat3d result(vecA[0]*vecB[0],vecA[0]*vecB[1],vecA[0]*vecB[2],
@@ -347,12 +347,12 @@ inline const Mat3d Mat3d::operator* (const Mat3d & mat2) const
 
 inline Mat3d inv(const Mat3d & mat)
 {
-  double invDeterminant = 1.0 / 
-    (-mat[0][2] * mat[1][1] * mat[2][0] + 
-      mat[0][1] * mat[1][2] * mat[2][0] + 
-      mat[0][2] * mat[1][0] * mat[2][1] - 
-      mat[0][0] * mat[1][2] * mat[2][1] - 
-      mat[0][1] * mat[1][0] * mat[2][2] + 
+  double invDeterminant = 1.0 /
+    (-mat[0][2] * mat[1][1] * mat[2][0] +
+      mat[0][1] * mat[1][2] * mat[2][0] +
+      mat[0][2] * mat[1][0] * mat[2][1] -
+      mat[0][0] * mat[1][2] * mat[2][1] -
+      mat[0][1] * mat[1][0] * mat[2][2] +
       mat[0][0] * mat[1][1] * mat[2][2] );
 
   return Mat3d(
@@ -368,14 +368,14 @@ inline Mat3d inv(const Mat3d & mat)
   );
 }
 
-inline double det(const Mat3d & mat) 
+inline double det(const Mat3d & mat)
 {
   return
-   (-mat[0][2] * mat[1][1] * mat[2][0] + 
-     mat[0][1] * mat[1][2] * mat[2][0] + 
-     mat[0][2] * mat[1][0] * mat[2][1] - 
-     mat[0][0] * mat[1][2] * mat[2][1] - 
-     mat[0][1] * mat[1][0] * mat[2][2] + 
+   (-mat[0][2] * mat[1][1] * mat[2][0] +
+     mat[0][1] * mat[1][2] * mat[2][0] +
+     mat[0][2] * mat[1][0] * mat[2][1] -
+     mat[0][0] * mat[1][2] * mat[2][1] -
+     mat[0][1] * mat[1][0] * mat[2][2] +
      mat[0][0] * mat[1][1] * mat[2][2] );
 }
 
@@ -402,8 +402,8 @@ inline std::ostream &operator << (std::ostream &s, const Mat3d &v)
 
   return(
     s << '[' << a00 << ' ' << a01 << ' ' << a02 << ']' << std::endl <<
-    s << '[' << a10 << ' ' << a11 << ' ' << a12 << ']' << std::endl <<
-    s << '[' << a20 << ' ' << a21 << ' ' << a22 << ']'
+    '[' << a10 << ' ' << a11 << ' ' << a12 << ']' << std::endl <<
+    '[' << a20 << ' ' << a21 << ' ' << a22 << ']'
   );
 }
 
@@ -412,7 +412,7 @@ inline void Mat3d::print()
   double a00 = elt[0][0]; double a01 = elt[0][1]; double a02 = elt[0][2];
   double a10 = elt[1][0]; double a11 = elt[1][1]; double a12 = elt[1][2];
   double a20 = elt[2][0]; double a21 = elt[2][1]; double a22 = elt[2][2];
-  
+
   printf("[%G %G %G;\n", a00, a01, a02);
   printf(" %G %G %G;\n", a10, a11, a12);
   printf(" %G %G %G]\n", a20, a21, a22);
diff --git a/src/libobjMesh/tribox3.cpp b/src/libobjMesh/tribox3.cpp
index 8e38dee4f87eab29e8688a4af69ba8928a9e5f71..b0860e91ed8cac0c355c71d3999194bf722a6e76 100644
--- a/src/libobjMesh/tribox3.cpp
+++ b/src/libobjMesh/tribox3.cpp
@@ -26,6 +26,7 @@
  *                                                                       *
  *************************************************************************/
 
+#include <algorithm>
 #include <stdio.h>
 #include <math.h>
 #include <iostream>
@@ -44,7 +45,7 @@ using namespace std;
 bool triBoxOverlap(double boxcenter[3], double boxhalfsize[3], double triverts[3][3])
 {
   bool overlap = true;
-  
+
   // translate so that box's center coincides with the origin
   VECTOR_SUBTRACTEQUAL3(triverts[0], boxcenter);
   VECTOR_SUBTRACTEQUAL3(triverts[1], boxcenter);
@@ -59,7 +60,7 @@ bool triBoxOverlap(double boxcenter[3], double boxhalfsize[3], double triverts[3
   double maxx = max( max(triverts[0][0], triverts[1][0]), triverts[2][0] );
   double maxy = max( max(triverts[0][1], triverts[1][1]), triverts[2][1] );
   double maxz = max( max(triverts[0][2], triverts[1][2]), triverts[2][2] );
-  
+
   if ( ( boxhalfsize[0] < minx ) || ( maxx < -boxhalfsize[0] ) || ( boxhalfsize[1] < miny ) || ( maxy < -boxhalfsize[1] ) || ( boxhalfsize[2] < minz ) || ( maxz < -boxhalfsize[2] ) )
   {
     //no overlap
@@ -80,7 +81,7 @@ bool triBoxOverlap(double boxcenter[3], double boxhalfsize[3], double triverts[3
   VECTOR_SUBTRACT3(triverts[1], triverts[0], f0);
   VECTOR_SUBTRACT3(triverts[2], triverts[1], f1);
   VECTOR_SUBTRACT3(triverts[0], triverts[2], f2);
- 
+
   double * e[3] = { e0, e1, e2 };
   double * f[3] = { f0, f1, f2 };
 
@@ -139,7 +140,7 @@ bool triBoxOverlap(double boxcenter[3], double boxhalfsize[3], double triverts[3
     }
   }
 */
-  
+
   // plane and AABB overlap test
   // 1 test
 
@@ -191,15 +192,15 @@ bool triBoxOverlap(double boxcenter[3], double boxhalfsize[3], double triverts[3
     }
   }
 */
-  
+
   if ( VECTOR_DOT_PRODUCT3(n, nearestPoint) + planeDist > 0 )
   {
     overlap = false;
     return overlap;
   }
-  
+
   overlap = ( VECTOR_DOT_PRODUCT3(n, farthestPoint) + planeDist >= 0 );
-  
+
   return overlap;
 }