Refresh bug fixed

And added logging