fix bug in which the learnt user model couldn't be saved in Mongodb
cleaning up according to pep8