made gpg cleanup simpler and more robust