Fixed refresh function.