add winservice, fix bugs