Fix model saving error handling