Bonding of solid lids or wafers to the substrate