fix runScript function bug