updated template for c++ compatibility.