Fixed templating and lvalue reference