Fixes to make this build on Ubuntu 12.04