Update the code to make it compile with c++11 on Ubuntu