added simple template function, avoid CSP restrict