Defect structure and charge transfer in undoped and doped lanthanum cobaltites