fix bug in save method