Inproper map layer removal fix

Hi, first all: thanks for you work. Its amasing!
I have maybe one issue: I have fixed it temporarily, it works now, but you will probably know hot to fix it right way.

Cheers, Vasek