Fix negative index values.