Waves in lattices with imperfect junctions and localized defect modes