Correct some warnings and compile problems