revert last two commits - does not work for negative indices