more progress on template function instantiation