Fixed segfault and glib errors (#23).