Hi, Lars.
We were having a lot of troubles with something very similar.
We thought that this is kind of a bug, but I couldn't find any note about this.
Do you have a SAP Note about this error?
We have rev 85 and have similar issues with UDF, but we don't have rev 91 to test in that environment.