ensure map gets updated before the final end