fix bug and make script shorter