The accuracy of the quantitative analysis of thick targets by XRF is impaired by effects due to the absorption of X-rays in
the matrix associated with the non-uniformity of the X-ray beam and the lack of knowledge of the actual distribution of trace
elements in the target. The uncertainty in the elemental mass associated to a definite number X-rays detected is discussed
in the paper. A correction factor is derived to account specifically for the effect of the absorption of X-rays and the non-uniformity
of the X-ray beam.