check that gpg is present and fix bugs