replace sample index