fix and improve string handling in G_PrintEntityNameList