Added error logging in the indexing script