Fix crash when leaving buggy maps.