Fixed bugs with the auto-refresh