fix for crash in saving