bug fixed in function TrainGLM