When using XQuery the getOut() function is called on the message so if it is not used at a place where the out is filled an empty out message will be created. With this xquery cannot be used for example in setBody, setHeader... and anywhere where the out is not filled.
An example where this causes real trouble:
<to uri="direct:follow" />
In the patch the out property in the xquery context is filled only if it is not null. With it all of my pipelines seem to work well for me.