bugfix to saving and sorting stock