Fix some issues in CryptExtension module and corresponding UnitTest for it