Fix updating the context of threads and index