changed snprintf to g_snprintf