Fix a lot of compiling errors