Fixed error calculating number of parameters