Bug fixes for dynamic union crypt_key