Fix problems creating template functions caused by the changes for the new single-name rule

These problems manifest when using more than one DB.