Fixed the button functions