back porting PR #2420 to maintenance cont. 2