removed dependency on unix filesystem
keeps cursor position after file save