correctly save and restore overlay string