Svace issue fix. change strncat to g_strlcat and some code clean up.