fixed regression to use 0 indexing