diff --git a/bob/learn/em/MAP_gmm_trainer.cpp b/bob/learn/em/MAP_gmm_trainer.cpp
index 4594673b385626f4aa74c7d4265af0e7584f5dfe..7c16576c8aad481ea32cfc49e22bfca0bab0b7df 100644
--- a/bob/learn/em/MAP_gmm_trainer.cpp
+++ b/bob/learn/em/MAP_gmm_trainer.cpp
@@ -185,7 +185,7 @@ PyObject* PyBobLearnEMMAPGMMTrainer_getRelevanceFactor(PyBobLearnEMMAPGMMTrainer
 int PyBobLearnEMMAPGMMTrainer_setRelevanceFactor(PyBobLearnEMMAPGMMTrainerObject* self, PyObject* value, void*){
   BOB_TRY
   
-  if(!PyNumber_Check(value)){
+  if(!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects a double", Py_TYPE(self)->tp_name, relevance_factor.name());
     return -1;
   }
@@ -211,7 +211,7 @@ PyObject* PyBobLearnEMMAPGMMTrainer_getAlpha(PyBobLearnEMMAPGMMTrainerObject* se
 int PyBobLearnEMMAPGMMTrainer_setAlpha(PyBobLearnEMMAPGMMTrainerObject* self, PyObject* value, void*){
   BOB_TRY
   
-  if(!PyNumber_Check(value)){
+  if(!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects a double", Py_TYPE(self)->tp_name, alpha.name());
     return -1;
   }
diff --git a/bob/learn/em/cpp/MAP_GMMTrainer.cpp b/bob/learn/em/cpp/MAP_GMMTrainer.cpp
index 64779c5f1b863f23a9ba3009dc2de73b16cbc9c4..7dcf504fbf98a6723869b6b444e6f1af3f7b9bb7 100644
--- a/bob/learn/em/cpp/MAP_GMMTrainer.cpp
+++ b/bob/learn/em/cpp/MAP_GMMTrainer.cpp
@@ -75,6 +75,10 @@ void bob::learn::em::MAP_GMMTrainer::mStep(bob::learn::em::GMMMachine& gmm)
 {
   // Read options and variables
   double n_gaussians = gmm.getNGaussians();
+  
+  //Checking if it is necessary to resize the cache
+  if((size_t)m_cache_alpha.extent(0) != n_gaussians)
+    initialize(gmm); //If it is different for some reason, there is no way, you have to initialize  
 
   // Check that the prior GMM has been specified
   if (!m_prior_gmm)
diff --git a/bob/learn/em/cpp/ML_GMMTrainer.cpp b/bob/learn/em/cpp/ML_GMMTrainer.cpp
index 1c5bc84b292eebcd5e95f35b54c60f177c404260..79f780273899f869a4a2763dd272fc8213e68eed 100644
--- a/bob/learn/em/cpp/ML_GMMTrainer.cpp
+++ b/bob/learn/em/cpp/ML_GMMTrainer.cpp
@@ -41,6 +41,10 @@ void bob::learn::em::ML_GMMTrainer::mStep(bob::learn::em::GMMMachine& gmm)
   // Read options and variables
   const size_t n_gaussians = gmm.getNGaussians();
 
+ //Checking if it is necessary to resize the cache
+ if((size_t)m_cache_ss_n_thresholded.extent(0) != n_gaussians)
+   initialize(gmm); //If it is different for some reason, there is no way, you have to initialize
+
   // - Update weights if requested
   //   Equation 9.26 of Bishop, "Pattern recognition and machine learning", 2006
   if (m_gmm_base_trainer.getUpdateWeights()) {
@@ -101,12 +105,3 @@ bool bob::learn::em::ML_GMMTrainer::operator!=
 {
   return !(this->operator==(other));
 }
-
-/*
-bool bob::learn::em::ML_GMMTrainer::is_similar_to
-  (const bob::learn::em::ML_GMMTrainer &other, const double r_epsilon,
-   const double a_epsilon) const
-{
-  return m_gmm_base_trainer.is_similar_to(other, r_epsilon, a_epsilon);
-}
-*/
diff --git a/bob/learn/em/gaussian.cpp b/bob/learn/em/gaussian.cpp
index 01327ea08e249c25bde199147a44d946f44f3638..8021a718ff735773748763bea64554738d02015d 100644
--- a/bob/learn/em/gaussian.cpp
+++ b/bob/learn/em/gaussian.cpp
@@ -105,7 +105,7 @@ static int PyBobLearnEMGaussian_init(PyBobLearnEMGaussianObject* self, PyObject*
   }
 
   /**If the constructor input is a number**/
-  if (PyNumber_Check(arg)) 
+  if (PyBob_NumberCheck(arg)) 
     return PyBobLearnEMGaussian_init_number(self, args, kwargs);
   /**If the constructor input is Gaussian object**/
   else if (PyBobLearnEMGaussian_Check(arg))
diff --git a/bob/learn/em/gmm_stats.cpp b/bob/learn/em/gmm_stats.cpp
index c38a674198d3e0b1c425322c485dc542b69f03a1..5befeb8e98743e236c37e0d77892ed5204b031f3 100644
--- a/bob/learn/em/gmm_stats.cpp
+++ b/bob/learn/em/gmm_stats.cpp
@@ -350,7 +350,7 @@ PyObject* PyBobLearnEMGMMStats_getLog_likelihood(PyBobLearnEMGMMStatsObject* sel
 int PyBobLearnEMGMMStats_setLog_likelihood(PyBobLearnEMGMMStatsObject* self, PyObject* value, void*){
   BOB_TRY
 
-  if (!PyNumber_Check(value)){
+  if (!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects an double", Py_TYPE(self)->tp_name, t.name());
     return -1;
   }
diff --git a/bob/learn/em/ivector_machine.cpp b/bob/learn/em/ivector_machine.cpp
index 257aafeef21dd96981b84f545e22241ac2997003..82df5e057c86f43b1b42ea5101ce97298ee99a90 100644
--- a/bob/learn/em/ivector_machine.cpp
+++ b/bob/learn/em/ivector_machine.cpp
@@ -270,7 +270,7 @@ PyObject* PyBobLearnEMIVectorMachine_getVarianceThreshold(PyBobLearnEMIVectorMac
 int PyBobLearnEMIVectorMachine_setVarianceThreshold(PyBobLearnEMIVectorMachineObject* self, PyObject* value, void*){
   BOB_TRY
 
-  if (!PyNumber_Check(value)){
+  if (!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects an double", Py_TYPE(self)->tp_name, variance_threshold.name());
     return -1;
   }
diff --git a/bob/learn/em/kmeans_trainer.cpp b/bob/learn/em/kmeans_trainer.cpp
index a55ee12538d12d9f8747a49eb7a8adadf8ddea0d..dd8f252c3067c4ee973880e7cfe91655f60ec0e1 100644
--- a/bob/learn/em/kmeans_trainer.cpp
+++ b/bob/learn/em/kmeans_trainer.cpp
@@ -49,7 +49,7 @@ static auto KMeansTrainer_doc = bob::extension::ClassDoc(
   .add_prototype("other","")
   .add_prototype("","")
 
-  .add_parameter("initialization_method", "str", "The initialization method of the means")
+  .add_parameter("initialization_method", "str", "The initialization method of the means.\nPossible values are: 'RANDOM', 'RANDOM_NO_DUPLICATE', 'KMEANS_PLUS_PLUS' ")
   .add_parameter("other", ":py:class:`bob.learn.em.KMeansTrainer`", "A KMeansTrainer object to be copied.")
 
 );
@@ -162,7 +162,10 @@ static auto initialization_method = bob::extension::VariableDoc(
   "initialization_method",
   "str",
   "Initialization method.",
-  ""
+  "Possible values:\n"
+  " `RANDOM`: Random initialization \n\n"
+  " `RANDOM_NO_DUPLICATE`: Random initialization without repetition \n\n"
+  " `KMEANS_PLUS_PLUS`: Apply the kmeans++ initialization http://en.wikipedia.org/wiki/K-means%2B%2B  \n\n"
 );
 PyObject* PyBobLearnEMKMeansTrainer_getInitializationMethod(PyBobLearnEMKMeansTrainerObject* self, void*) {
   BOB_TRY
@@ -254,7 +257,7 @@ PyObject* PyBobLearnEMKMeansTrainer_getAverageMinDistance(PyBobLearnEMKMeansTrai
 int PyBobLearnEMKMeansTrainer_setAverageMinDistance(PyBobLearnEMKMeansTrainerObject* self, PyObject* value, void*) {
   BOB_TRY
 
-  if (!PyNumber_Check(value)){
+  if (!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects an double", Py_TYPE(self)->tp_name, average_min_distance.name());
     return -1;
   }
diff --git a/bob/learn/em/plda_base.cpp b/bob/learn/em/plda_base.cpp
index 5e1b9d62b87bb45098f399de4e15e783a886d89a..5cfb508c1ec72117e2f31c41a6312fefaa7c3cab 100644
--- a/bob/learn/em/plda_base.cpp
+++ b/bob/learn/em/plda_base.cpp
@@ -397,7 +397,7 @@ static PyObject* PyBobLearnEMPLDABase_getVarianceThreshold(PyBobLearnEMPLDABaseO
 int PyBobLearnEMPLDABase_setVarianceThreshold(PyBobLearnEMPLDABaseObject* self, PyObject* value, void*){
   BOB_TRY
 
-  if (!PyNumber_Check(value)){
+  if (!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects an float", Py_TYPE(self)->tp_name, variance_threshold.name());
     return -1;
   }
diff --git a/bob/learn/em/plda_machine.cpp b/bob/learn/em/plda_machine.cpp
index 734cb58a428c34dcf9622dd275039a808ef8f962..4174084a90a396f22b86709fb5a5c92e035f66bc 100644
--- a/bob/learn/em/plda_machine.cpp
+++ b/bob/learn/em/plda_machine.cpp
@@ -220,7 +220,7 @@ static PyObject* PyBobLearnEMPLDAMachine_getWSumXitBetaXi(PyBobLearnEMPLDAMachin
 int PyBobLearnEMPLDAMachine_setWSumXitBetaXi(PyBobLearnEMPLDAMachineObject* self, PyObject* value, void*){
   BOB_TRY
 
-  if (!PyNumber_Check(value)){
+  if (!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects an float", Py_TYPE(self)->tp_name, w_sum_xit_beta_xi.name());
     return -1;
   }
@@ -312,7 +312,7 @@ static PyObject* PyBobLearnEMPLDAMachine_getLogLikelihood(PyBobLearnEMPLDAMachin
 int PyBobLearnEMPLDAMachine_setLogLikelihood(PyBobLearnEMPLDAMachineObject* self, PyObject* value, void*){
   BOB_TRY
 
-  if (!PyNumber_Check(value)){
+  if (!PyBob_NumberCheck(value)){
     PyErr_Format(PyExc_RuntimeError, "%s %s expects an double", Py_TYPE(self)->tp_name, log_likelihood.name());
     return -1;
   }
diff --git a/version.txt b/version.txt
index 75a031333ef0bd7cc424e9a14def7ab39b05e79a..4cc35b76f6f06fd49559c2b6be7f3675abdb59e0 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-2.0.0b3
\ No newline at end of file
+2.0.0b6