Fixed error in where the array was created and filled