Investigation of work function and chemical composition of thin films of borides and nitrides