negative index value fix