Fixes bug in save method in model.