Compositional Inhomogeneity And Defects In Nanomaterials For Optoelectronics