modify template to fix query issue