fix logic bug in getthreadid