fixed IV/Key Helper Function