Multiple compile error and warning fixes