Fixed key init code