A modification to the general-purpose Monte Carlo electron-photon transport code EGS4 [1] was made in order to include Doppler broadening of Compton-scattered photon energy due to electron pre-collision motion. The Compton-scattered photon energy is sampled from a cross section formula based on the Compton profile, and the Compton scattering is sustained if the energy imparted to the electron is less than its binding energy. The electron binding effect modifies the scattered photon energy, angular distribution, and total cross section of the Compton scattering, and affects the photon mean free path used in the calculations. In the improved EGS4 code, all of these electron binding effects in Compton scattering are treated consistently. A simulation of 40 keV photon scattering by C and Cu samples was performed using the improved EGS4 code; the calculated scattered photon spectra agreed well with the measurements.