Fix code generation failures and add Cast Symbol.