Compare num tasks with previous count instead of 0, to handle stray tasks from other tests.  Also, sleep after transaction to the the stats server to catch up.