having trouble inserting values into the array