added "sync-before-saving" functionality