fix refresh code