fix a set_context, a popup and DB warnings on history page