fix undo. also move to iframe for js execution