Pab/obuild fixes

This is a small patch which ensures that foam{To,Fr}Buffer can be round tripped properly. This ought to fix some of issues when building with obuild.  It now compiles, but some tests fail.  How do you run the testsuite?

 I  branched it off from 'master' (ignoring pab/devel), as it might uncover some issues in the later patch series.