Fixed handling of explicit template uniqueids