bugfix of crash of handler threads in supervisor
correct codes for pull request review 282b9637f1