fix saving of global