Variables initialization in Keras custom model

I am testing a Keras model with custom layers. In a custom layer I am using two global variables. After model building, I save it before it is trained in order to be able to reload and retrain it with different input data.
Everything worked fine, but the problem is that I get different results in these two scenarios: 1) I build the model from scratch and then I train it, and 2) I reload the untrained saved version and train it.
I believe it has something to do with how global variables are used by the model, therefore I also tried to include them in self. at init and build. Still having the same problem.

Thank you in advance for your help.