Fix compiler warnings and build