It was poor defending at set pieces which cost Manchester City victory against Cardiff City, according to manager Manuel Pellegrini.