Fix some implementation problems with retrieve