bugfix for saving queries tool (incl. restoring previous badly saved queries)