Modelingtoolkitize does not work when parameter is passed

I am trying to solve 5 odes in the code below. I see a peculiar problem when I try to use modelingtoolkitize. The code below works if I use size=5 but not if I use the parameter to define size (size=p[1]). Why is this happening when p[1] is equal to 5. The problem does not arise if I just solve the system without using modelingtoolkitize.

using ModelingToolkit
using DifferentialEquations

function eoms!(du,u,p,t)
    size=p[1]  ### does not work.
    ## size=5 ### works
    for i in 1:size
        du[i]=-1.0*u[i]
    end
end

size=5
u0=ones(Float64,size)
tspan=(0.0,10.0)
p=[size]
prob=ODEProblem(eoms!,u0,tspan,p)

prob_=modelingtoolkitize(prob)
fastprob = ODEProblem(prob_,u0,tspan,jac=true)
#fastprob=prob

tol=1e-6
reltolp=tol
abstolp=tol

@time sol=solve(prob,Rosenbrock23(),abstol=abstolp,reltol=reltolp)
@time sol1=solve(fastprob,Rosenbrock23(),abstol=abstolp,reltol=reltolp)

println(sol.destats)
println("-------")
println(sol1.destats)

using Plots
plot(sol, vars=(1),yaxis=:log10)
plot!(sol, vars=(2),yaxis=:log10)
plot!(sol, vars=(3),yaxis=:log10)
plot!(sol, vars=(4),yaxis=:log10)
plot!(sol1, vars=(1),yaxis=:log10)
plot!(sol1, vars=(2),yaxis=:log10)
plot!(sol1, vars=(3),yaxis=:log10)
plot!(sol1, vars=(4),yaxis=:log10)

modelingtoolkitize requires a code is quasi-static, so the computation is not dependent on values.