Fix incorrect allocation of array