Bugfixes in map stack handling.