Fixed create_local_db_index function