am 017de989: Rework the key insertion logic

* commit '017de9893efd33e179db10bc71189e150bc3486d':
  Rework the key insertion logic