first of many bugs: wrong passage of argument to  Thread function