changed order of global history update