storing to array working properly