porting to upstream version 2.11.2