replace digit at index