fix templates to work with pre c++11