Some vectors were defined as Real name[size] in stead of Real[size] name
Solving this + adapting the sizes of the arrays by using eg. [nmodulation, : ,:] instead of [nmodulations] seems to help.