Fix many compiling errors