bugfix on click_on_pat function.