diff --git a/packages/ui-default/templates/components/problem.html b/packages/ui-default/templates/components/problem.html
index 245711184..92a17700c 100644
--- a/packages/ui-default/templates/components/problem.html
+++ b/packages/ui-default/templates/components/problem.html
@@ -8,7 +8,7 @@
{%- if tdoc and alphabetic -%}
{{ String.fromCharCode(65 + tdoc.pids.indexOf(pdoc.docId)) if tdoc.pids.includes(pdoc.docId) else '#' }}
{%- else -%}
- {{ pdoc.pid.split('-')[1] if pdoc.pid else ('P'+pdoc.docId) }}
+ {{ (pdoc.pid.split('-')[1] if pdoc.pid.includes('-') else pdoc.pid) if pdoc.pid else ('P'+pdoc.docId) }}
{%- endif -%}
{%- if not small -%} {{ pdoc.title }}{%- endif -%}
{%- if not invalid -%}