add local test, fix shutdown