diff --git a/mgllab/CMakeLists.txt b/mgllab/CMakeLists.txt
index 1649104..eeec1c1 100644
--- a/mgllab/CMakeLists.txt
+++ b/mgllab/CMakeLists.txt
@@ -38,7 +38,11 @@ if(MGL_HAVE_FLTK)
 		set(mgllab_src ${mgllab_src} mgllab.rc)
 	endif(WIN32)
 	add_executable(mgllab ${mgllab_src} ${mgllab_hdr})
-	target_link_libraries(mgllab mgl mgl-fltk ${FLTK_LIBRARIES})
+	if(WIN32)
+		target_link_libraries(mgllab mgl mgl-fltk mgl-fltk-static mgl-static getopt-static ${FLTK_LIBRARIES})
+	else(WIN32)
+		target_link_libraries(mgllab mgl mgl-fltk ${FLTK_LIBRARIES})
+	endif(WIN32)	
 	install(
 		TARGETS mgllab
 		RUNTIME DESTINATION bin	)
diff --git a/mgllab/table.cpp b/mgllab/table.cpp
index 5243549..23eebe5 100644
--- a/mgllab/table.cpp
+++ b/mgllab/table.cpp
@@ -559,8 +559,13 @@ public:
 		o->tooltip(_("Change data values and close this window"));
 		w->set_modal();	w->end();
 	}
-	double min()	{	return wmin->value();	}
-	double max()	{	return wmax->value();	}
+	#if WIN32
+		double _min()	{	return wmin->value();	}
+		double _max()	{	return wmax->value();	}
+	#else
+		double min()	{	return wmin->value();	}
+		double max()	{	return wmax->value();	}	
+	#endif			
 	int sym()		{	return wsym->value();	}
 	bool ok()		{	return !result.empty();	}
 	void cb_ok()
@@ -581,8 +586,14 @@ void fill_cb(Fl_Widget*, void*v)
 		HMDT d = dynamic_cast<HMDT>(e->var);
 		HADT c = dynamic_cast<HADT>(e->var);
 		char ch = nrm_dlg.result[0];
-		if(d)	{	d->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
-		if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
+		#if WIN32
+			if(d)	{	d->Fill(nrm_dlg._min(),nrm_dlg._max(),ch);	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg._min(),nrm_dlg._max(),ch);	e->refresh();	}
+		#else
+			if(d)	{	d->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
+		#endif		
+					
 	}
 }
 //-----------------------------------------------------------------------------
@@ -594,8 +605,13 @@ void normal_cb(Fl_Widget*, void*v)
 	{
 		HMDT d = dynamic_cast<HMDT>(e->var);
 		HADT c = dynamic_cast<HADT>(e->var);
-		if(d)	{	d->Norm(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
-		if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
+		#if WIN32
+			if(d)	{	d->Norm(nrm_dlg._min(),nrm_dlg._max(),nrm_dlg.sym());	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg._min(),nrm_dlg._max(),nrm_dlg.sym());	e->refresh();	}
+		#else
+			if(d)	{	d->Norm(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
+		#endif				
 	}
 }
 //-----------------------------------------------------------------------------
diff --git a/src/parser.cpp b/src/parser.cpp
index 577191d..e6909a1 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -58,7 +58,10 @@ void mglParser::FillBaseCmd()
 HMDT MGL_NO_EXPORT mglFormulaCalc(std::wstring string, mglParser *arg, const std::vector<mglDataA*> &head);
 HADT MGL_NO_EXPORT mglFormulaCalcC(std::wstring string, mglParser *arg, const std::vector<mglDataA*> &head);
 //-----------------------------------------------------------------------------
+#ifndef MGL_ASK_FUNC
+#define MGL_ASK_FUNC
 MGL_EXPORT void (*mgl_ask_func)(const wchar_t *, wchar_t *)=0;
+#endif
 void MGL_EXPORT mgl_ask_gets(const wchar_t *quest, wchar_t *res)
 {	printf("%ls\n",quest);	if(!fgetws(res,1024,stdin))	*res=0;	}
 //-----------------------------------------------------------------------------
@@ -69,7 +72,10 @@ void MGL_EXPORT mgl_progress_txt(int value, int maximal, HMGL)
 	else	for(int i=prev;i<value;i++)	printf("#");
 	prev = value;	fflush(stdout);
 }
+#ifndef MGL_PROGRESS_FUNC
+#define MGL_PROGRESS_FUNC
 MGL_EXPORT void (*mgl_progress_func)(int value, int maximal, HMGL)=mgl_progress_txt;
+#endif
 void MGL_EXPORT mgl_progress(int value, int maximal, HMGL gr)
 {	mgl_progress_func(value, maximal, gr);	}
 //-----------------------------------------------------------------------------
diff --git a/utils/mglview.cpp b/utils/mglview.cpp
index d360df3..7e2634b 100644
--- a/utils/mglview.cpp
+++ b/utils/mglview.cpp
@@ -29,6 +29,18 @@
 	#include "mgl2/qt.h"
 #endif
 //-----------------------------------------------------------------------------
+#ifdef WIN32
+#ifndef MGL_ASK_FUNC
+#define MGL_ASK_FUNC
+MGL_EXPORT void (*mgl_ask_func)(const wchar_t *, wchar_t *)=0;
+#endif
+#ifndef MGL_PROGRESS_FUNC
+#define MGL_PROGRESS_FUNC
+MGL_EXPORT void (*mgl_progress_func)(int value, int maximal, HMGL)=0;
+#endif
+MGL_EXPORT std::string mglGlobalMess;	///< Buffer for receiving global messages
+#endif
+//-----------------------------------------------------------------------------
 std::wstring str, opt;
 std::vector<std::string> anim;
 mglParse p(true);
diff --git a/include/mgl2/datac.h b/include/mgl2/datac.h
index f2c0251..0e69de7 100644
--- a/include/mgl2/datac.h
+++ b/include/mgl2/datac.h
@@ -474,7 +474,7 @@ using mglDataA::Momentum;
 	void set_v(mreal val, long i,long j=0,long k=0)	{	a[i+nx*(j+ny*k)]=val;	}
 #else
 	/// Get the value in given cell of the data with border checking
-	mreal v(long i,long j=0,long k=0) const	{	return mgl_abs(mgl_datac_get_value(this,i,j,k));	}
+	mreal v(long i,long j=0,long k=0) const	{	return abs(a[i+nx*(j+ny*k)]);	}
 	/// Set the value in given cell of the data
 	void set_v(mreal val, long i,long j=0,long k=0)	{	mgl_datac_set_value(this,val,i,j,k);	}
 #endif
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0c779d..acd9d7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -579,10 +579,15 @@ if(enable-glut)
 	if(NOT MGL_HAVE_OPENGL)
 		message(SEND_ERROR "You have to enable OpenGL if you plan to use GLUT.")
 	endif(NOT MGL_HAVE_OPENGL)
-	include(FindGLUT)
+    find_path(GLUT_INCLUDE_DIR freeglut.h PATH_SUFFIXES GL)
+    include(SelectLibraryConfigurations)
+    find_library(GLUT_LIBRARY_RELEASE NAMES freeglut)
+    find_library(GLUT_LIBRARY_DEBUG NAMES freeglutd)
+    select_library_configurations(GLUT)
 	if(NOT GLUT_FOUND)
 		message(SEND_ERROR "Couldn't find GLUT library.")
 	endif(NOT GLUT_FOUND)
+    include_directories(${GLUT_INCLUDE_DIR}/GL)
 else(enable-glut)
 	set(MGL_HAVE_GLUT 0)
 endif(enable-glut)
