fixing marker click event listeners in javascript