Fixed index error in arraylist when changes bases.