some changes in index sampling