fix NPE bug for ThreadEndEvent