Fixed error when using formulas + set_random