We studied the solid state dewetting of thin Ni films and Ni-Co bilayers deposited on sapphire substrate during slow heating to several target temperatures. We demonstrated that during initial stages of dewetting and bilayers intermixing, Ni atoms from the top layer diffuse along the interface between the bottom Co layer and sapphire, simultaneously with Co atoms diffusion on the surface of Ni layer. This alloying of the top surface layer with Co slows down the rate of thermal grain boundary grooving and leads to the increase of the thermal stability of the bilayers with increasing Co content. We also observed that during intermediate stages of dewetting the regions of the untransformed film with increased thickness are dotted with small surface pores of 20-30 nm in diameter reaching to the level of as-deposited film. We related the formation and extraordinary stability of these pores with the modalities of surface diffusion of metal atoms in the presence of segregated impurities. In particular, we emphasized the role of Ehrlich-Schwoebel barrier for adatoms attachment to the edge of (111) terrace in formation of the pores. Our results indicate that the fine features of surface diffusion and surface thermodynamics, together with the presence of impurities and defects in the film lead to a rich variety of film morphologies during solid state dewetting.