Index: cpp/frams/model/autoname.cpp
===================================================================
--- cpp/frams/model/autoname.cpp	(revision 1125)
+++ cpp/frams/model/autoname.cpp	(revision 1130)
@@ -1,8 +1,8 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
 #include "autoname.h"
-#include "common/nonstd_stl.h"
+#include <algorithm>
 #include <ctype.h>
 
@@ -100,5 +100,5 @@
 	if (model.getPartCount() > 0)
 	{
-		cialo = min((int)(sqrt(double(model.getPartCount()) - 1) * NAME_BODYLEN), NAME_MAXLENBODY - 1);
+		cialo = std::min((int)(sqrt(double(model.getPartCount()) - 1) * NAME_BODYLEN), NAME_MAXLENBODY - 1);
 		poz = 0;
 		for (i = 0; i <= cialo; i++) // budowanie "opisu" ciala
@@ -106,6 +106,6 @@
 			nextpoz = ((model.getPartCount()) * (i + 1)) / (cialo + 1) - 1;
 			w = 1.0;
-			for (; poz <= nextpoz; poz++) w = max(w, model.getPart(poz)->mass);
-			tmpc[i] = Sp[min(int((w - 1.0) * NAME_BODYMASS), int(sizeof(Sp)) - 2)];
+			for (; poz <= nextpoz; poz++) w = std::max(w, model.getPart(poz)->mass);
+			tmpc[i] = Sp[std::min(int((w - 1.0) * NAME_BODYMASS), int(sizeof(Sp)) - 2)];
 		}
 		tmpc[i] = 0;
@@ -117,5 +117,5 @@
 	if (model.getNeuroCount() > 0)
 	{
-		mozg = min((int)(sqrt((double)model.getNeuroCount()) * NAME_BRAINLEN), NAME_MAXLENBRAIN - 1);
+		mozg = std::min((int)(sqrt((double)model.getNeuroCount()) * NAME_BRAINLEN), NAME_MAXLENBRAIN - 1);
 		poz = 0;
 		for (i = 0; i <= mozg; i++) // budowanie "opisu" mozgu
@@ -123,6 +123,6 @@
 			nextpoz = (model.getNeuroCount() * (i + 1)) / (mozg + 1) - 1;
 			wint = 0;
-			for (; poz <= nextpoz; poz++) wint = max(wint, model.getNeuro(poz)->getInputCount());
-			tmpm[i] = Sam[min(int(wint * NAME_BRAININP), int(sizeof(Sam)) - 2)];
+			for (; poz <= nextpoz; poz++) wint = std::max(wint, model.getNeuro(poz)->getInputCount());
+			tmpm[i] = Sam[std::min(int(wint * NAME_BRAININP), int(sizeof(Sam)) - 2)];
 		}
 		tmpm[i] = 0;
Index: cpp/frams/model/model.h
===================================================================
--- cpp/frams/model/model.h	(revision 1125)
+++ cpp/frams/model/model.h	(revision 1130)
@@ -13,4 +13,5 @@
 #include <frams/util/advlist.h>
 #include <frams/util/usertags.h>
+#include <common/nonstd_stl.h>
 
 extern ParamEntry f0_model_paramtab[];
Index: cpp/frams/model/similarity/EMD/emd.c
===================================================================
--- cpp/frams/model/similarity/EMD/emd.c	(revision 1125)
+++ cpp/frams/model/similarity/EMD/emd.c	(revision 1130)
@@ -19,4 +19,5 @@
 #include <stdlib.h>
 #include <math.h>
+#include <algorithm>
 
 #include "emd.h"
@@ -100,5 +101,5 @@
 {
   int itr;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   double totalCost;
   float w;
@@ -211,5 +212,5 @@
 {
   int i, j;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   double sSum, dSum, diff;
   feature_t *P1, *P2;
@@ -474,5 +475,5 @@
 {
     int i, j, k;
-    int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+    int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
     double xMin;
     int steps;
@@ -555,5 +556,5 @@
 {
   int i, steps;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   node2_t **CurX, *NewX;
   char *IsUsed=new char[2*max_n]; 
@@ -652,5 +653,5 @@
 {
   int i, j, found, minI, minJ;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   double deltaMin, oldVal, diff;
   double** Delta = new double*[_n1];
Index: cpp/frams/model/similarity/measure-distribution.cpp
===================================================================
--- cpp/frams/model/similarity/measure-distribution.cpp	(revision 1125)
+++ cpp/frams/model/similarity/measure-distribution.cpp	(revision 1130)
@@ -79,5 +79,5 @@
 	//int size = sampled.getPartCount();
 	//if (size < (int) sqrt((double) std::numeric_limits<int>::max())) //prevent exceeding int limits
-	//	samples_taken = min(samples_num, size*size);
+	//	samples_taken = std::min(samples_num, size*size);
 
 	rndgen.seed(55); //For determinism. Otherwise the descriptors (that choose samples pseudo-randomly) for the same Model can yield different values and so the dissimilarity between the object and its copy will not be 0.
