fix bug in ps script