fix bugs in service script