fix bug with indexing file