fix bug of reusing crypto instance