change each_with_index to each; Remove exception var

1. Change `each_with_index` to `each`
2. Remove exception var