fix the bug where variates are not saved consistently