try to make thread_stop python3 compatibile