Rebases on top of upstream's current master

The current version fails to build with 2.1.2