Fixed bug in _rebuild_master_index.