Add more collision detection.Fix some compiling problems.