fixed reference error, template issue