ProfileX error calculation after scaling 2d histogram

I have a question about the error bar calculation when calling TProfileX from a TH2D. The problem occurs when I first scale the TH2D by a value (e.g. Scale(1./10000)). ProfileX() gives the correct the error. However, directly using the formula of std err of mean will give an extra factor sqrt(10000). I wonder how profileX knows to correct for this scale. Attached is the code to illustrate this. Thanks.
test.C (1.3 KB)

TProfile Class Reference