I rebased the patch onto current master. Florian