Fix potential bug on history event