Strain profiles in thin films: influence of a coherently diffracting substrate and thickness fluctuations