solve a bug in viewer & index states