added logic to redraw map if it is dirty