fix bug in thread_reportin (watchdog can detect getwork is false before thr->last is set), and a few cosmetic changes