create index file and fix some error logging