fixed problem with deciding the size of array