fixed lots of compiling errors