- Why don't you attach an error indicator and look it if tries to tell you something interesting.
- Is the string diagram constant in the lower code equivalent to the output of the typecast operation?
- why are you aoutoindexing the path at the array output?
- ...
it probably would help to see the actual code.