Fixed some bugs in overlay mapping