fixing the click issue on legend