implement switching between global key and indice