Back-porting some code.