Fix indexing mistake, add tests file.