fixed to work with C++11