handle errors on save