Apply partial patch from jensverwiebe to tribox3_d.cc