Electron trapping in ferroelectric HfO2