fixed the bug related to the buttons
some cleanup