Fix bug of saving incorrect population history