Fixed an indexing bug