fixed refresh context logic