remove the last lines in templates