fixes to trunk 3991