map on click event removed when not needed