thread index error fixed