Fix tests threading bug.