Fixed an issue that caused the template manager to use invalid template IDs