fixed an indexing error