Fix warnings and support C++11