check doc contains sub_type before rendering it

fixes huge ugly yellow freemarker message.