Fix saving database periodically for gobject introspection and a patch from leftmostcat