fix bugs caused by gcc version switch