Add some GCC check flags and fix the problems