Compile and warning fixes