fix bug in create_index