Prepared for C++11 and fixed a grave bug revealed by gcc4.8