fixed bug in new indexing for negative numbers