fix for mapping with multiple layers

See https://bugs.dojotoolkit.org/ticket/18129


Note:
Sorry for the extra (and reverted) commit fba0f0b.
I may have made a mistake when I created the 18129 branch.