remove obsolete code from template expression