Preserve g_layouts across map changes.

This needs to be properly fixed. It's a mess…