fix bug of template mode