Fix #2532825. "Merged" in 286.

Manual merge of pr 286. 

@lsmith
@ItsAsbreuk 
@ericf
@davglass