Small fix for thread index