Porting 2.x fix over to 3.x