Fixed bug with finalizing Encrypt/Sign operations