fixing set_context after set_id corner case