some glib helper functions