added set function to dynamic array