Compilation and warning fixes