added template func , changed some string compare instead of GQuark compare