py: change negative array indices with array - 1.