fix potential crash on using save button

issue #54