diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 59a50d34a152b6e43028921561cb1c42d3d21ceb..4c03d8b5801fd9f865f3e8492b5152381ba4f1f9 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -202,7 +202,7 @@ void ParseString(std::string str)
   std::string fileName = CTX::instance()->homeDir + CTX::instance()->tmpFileName;
   FILE *fp = fopen(fileName.c_str(), "w");
   if(fp){
-    fprintf(fp, "%s", (str + "\n").c_str());
+    fprintf(fp, "%s\n", str.c_str());
     fclose(fp);
     ParseFile(fileName, true);
     GModel::current()->importGEOInternals();
@@ -426,7 +426,6 @@ void OpenProject(std::string fileName)
   // merge the file
   MergeFile(fileName);
 
-
   // merge the associated option file if there is one
   if(!StatFile(fileName + ".opt"))
     MergeFile(fileName + ".opt");
diff --git a/configure b/configure
index 0a3ee5d06137d90eed8c2d05eab3d4b329972890..08514685cfdcb040cda6dec8f7cb05358b4f01f0 100755
--- a/configure
+++ b/configure
@@ -4868,9 +4868,9 @@ if test "x$enable_occ" = "xyes"; then
   if test "x${OCC_PREFIX}" != "x"; then
     LDFLAGS="-L${OCC_PREFIX}/lib ${LDFLAGS}"
   fi
-  { echo "$as_me:$LINENO: checking for main in -lTKernel" >&5
-echo $ECHO_N "checking for main in -lTKernel... $ECHO_C" >&6; }
-if test "${ac_cv_lib_TKernel_main+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sin in -lTKernel" >&5
+echo $ECHO_N "checking for sin in -lTKernel... $ECHO_C" >&6; }
+if test "${ac_cv_lib_TKernel_sin+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -4882,11 +4882,17 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sin ();
 int
 main ()
 {
-return main ();
+return sin ();
   ;
   return 0;
 }
@@ -4909,22 +4915,88 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_TKernel_main=yes
+  ac_cv_lib_TKernel_sin=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_TKernel_main=no
+	ac_cv_lib_TKernel_sin=no
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_TKernel_main" >&5
-echo "${ECHO_T}$ac_cv_lib_TKernel_main" >&6; }
-if test $ac_cv_lib_TKernel_main = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_TKernel_sin" >&5
+echo "${ECHO_T}$ac_cv_lib_TKernel_sin" >&6; }
+if test $ac_cv_lib_TKernel_sin = yes; then
   OCC="yes"
+else
+  { echo "$as_me:$LINENO: checking for cos in -lTKernel" >&5
+echo $ECHO_N "checking for cos in -lTKernel... $ECHO_C" >&6; }
+if test "${ac_cv_lib_TKernel_cos+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lTKernel "-ldl" $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_TKernel_cos=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_TKernel_cos=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_TKernel_cos" >&5
+echo "${ECHO_T}$ac_cv_lib_TKernel_cos" >&6; }
+if test $ac_cv_lib_TKernel_cos = yes; then
+  OCC=yes
+fi
+
 fi
 
   if test "x${OCC}" = "xyes"; then
diff --git a/configure.in b/configure.in
index 7732fd1fdcf331c9147c7247c0590884ecd2ecb7..9aff10bd2461ba816f3c02bd23f084fee64d4c74 100644
--- a/configure.in
+++ b/configure.in
@@ -535,7 +535,7 @@ if test "x$enable_occ" = "xyes"; then
   if test "x${OCC_PREFIX}" != "x"; then
     LDFLAGS="-L${OCC_PREFIX}/lib ${LDFLAGS}"
   fi
-  AC_CHECK_LIB(TKernel,main,OCC="yes")
+  AC_CHECK_LIB(TKernel,sin,OCC="yes", AC_CHECK_LIB(TKernel,cos,OCC=yes,,"-ldl"))
   if test "x${OCC}" = "xyes"; then
     # DataExchange (subset; see occ/ros/adm/make/Makefile for more info)
     OCC_LIBS="-lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKIGES -lTKXSBase"
diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi
index d7602aa93f60f1e73c0e430856bc7467ed912b6c..f9531db7da93eddf833ca4c3f937893f89fa0dae 100644
--- a/doc/texinfo/gmsh.texi
+++ b/doc/texinfo/gmsh.texi
@@ -2229,10 +2229,10 @@ tetrahedral mesh generator and three-dimensional Delaunay triangulator},
 2004.}. Then a three-dimensional version of the 2D Delaunay algorithm
 described above is applied.
 @item
-The ``Frontal'' algorithm uses J. Schoeberl's Netgen
-algorithm@footnote{J. Schoeberl, @emph{Netgen, an advancing front
-2d/3d-mesh generator based on abstract rules}, Comput. Visual. Sci., 1,
-pp. 41--52, 1997.}.
+The ``Frontal'' algorithm uses J. Schoeberl's Netgen algorithm
+@footnote{J. Schoeberl, @emph{Netgen, an advancing front 2d/3d-mesh
+generator based on abstract rules}, Comput. Visual. Sci., 1, pp. 41--52,
+1997.}.
 @end enumerate
 
 The ``Delaunay'' algorithm is the most robust and the fastest, and is