save keyring in-place, fixes #228, #203