fixed a lot using spongycastle