change terminate-cmd compare function to strncmp
fix worker shutdown leak