fixed a bug on stockhelper.js and finished the logic of save record