Startup index loading and code format

The index was not loaded on application startup if the root directory contains the index. A call of "build_index" could overwrite the existing index. This is fixed now.