Add key checking before replacing EXTENSION_CODE and EXTENSION_INIT