Hi Ricardo,
thanks for taking the time to test stuff and sort it out :-)
The point seems to be how $bbdoc is assigned within the control
  structure #foreach. Does this make sense for you?
Thanks! 
I must admit I have no idea why the code behaves this way, but since your
code apparently works better than mine I updated the XAR using it :-) -> if
it works let's use it ;-)
Thanks for your help,
Guillaume