Dopants and defects: local structure and dynamics in barium cerates and zirconates