add serialization for global counter
update to save global counter