LB-561

a simple fix

This is just the "LB-561: Wrong exception handling" commit. The other are probably from some missing merge on the upstream side.