storing into struct array working fine