fix the isButtonClicked function