modifications to kill thread