fixed some weird problem related to thread purging