Fixes for compiling on Ubuntu 12.04