Rendering in C++ with USceneCaptureComponent2D, tone mapping randomly not being applied

Hi, I’m trying to render out scenes to an image, and probably 2/3 of the time my C++ code works great and the output looks exactly like what I see on screen. But randomly, about 30% of the time, the output seems to be rendered without the tone mapping step applied. Any ideas? Here’s my code, and I’ll attach two images rendered with the exact same code where you can see what is happening (the darker one is wrong, missing tone mapping).

UTextureRenderTarget2D* renderTarget = NewObject<UTextureRenderTarget2D>(this);
renderTarget->InitCustomFormat(imgWidth, imgHeight, EPixelFormat::PF_B8G8R8A8, true);
renderTarget->TargetGamma = 1.001f; // has to be just over 1.0 in order to work on backgrounds with tonemapping for unknown reasons
renderTarget->UpdateResourceImmediate();

USceneCaptureComponent2D* sceneCapture2D = NewObject<USceneCaptureComponent2D>(this);
sceneCapture2D->bCaptureEveryFrame = true;
sceneCapture2D->CompositeMode = SCCM_Overwrite; // not sure if this is necessary
sceneCapture2D->DetailMode = EDetailMode::DM_MAX;

sceneCapture2D->CaptureSource = SCS_FinalColorLDR; // works on everything, gamma has to be slightly over 1 to work on tonemapped BGs
//sceneCapture2D->CaptureSource = SCS_FinalColorHDR; // seems to ignore tonemapping step
//sceneCapture2D->CaptureSource = SCS_SceneColorHDR; // seems to ignore tonemapping step

sceneCapture2D->TextureTarget = renderTarget;

sceneCapture2D->SetCameraView(viewInfo);

sceneCapture2D->CaptureScene();

Updated to UE4 4.25.3 and set the gamma to 2.2, and now it consistently renders correctly (i.e. the same as what’s on the screen).