Fixed script saving (issue #348)