fix safe memory mode