fixed refresh loop