buffer overflow: clean up old checking for negative index