Fixed some bugs in save