added bounds for the cor parameter otherwise sometimes the fit doesn't work