fix bug to save data on mongodb