fixed template query string handling