Fix adding table bug and rename index