make template code comply with g++ 4.2.1