server: fix bug in going from thread_number to thread