fixes and simplifications to fix gpg regression.