             }
             output.append("""
                 ])
-                        if let function = result as? ([Any]) -> Any {
+                        if let function = result as? ([Any]) -> Any? {
                             return \(type)Run(function)
                         } else {
                             return result as! \(type)

            }
        }
        output.append("""
                private func run(function: Function, symbols: Symbols, stack: [Runtime]) -> Any {
                    let runtime = stack.last!
                    for (i, step) in function.steps.enumerated() {
                        switch step.producer! {

        output.append("""
                        }
                    }
                    if !function.hasReturnStep { return nil }
                    let returnValue = value(function.returnStep, in: stack)
                    if let function = returnValue as? Function {
                        return { self.run(function: function, symbols: symbols, stack: stack + [Runtime(arguments: $0)]) }
