Fixed a bug which made window to crash on consecutive save