Fix sync issue between plan history and engine