Rebased patch to compile against BFS 0.330+