More Bug 818316 porting