Fixed autorefresh loop