fixed a bug that inserting gimage fails somehow once the dialog is cancelled