Fix a bunch of compile time warnings and a build failure on ubuntu.