fixing button functionality