Fixed some bugs in service.autostart, and updated testcases