Fixed some issues with saving and sorting