Fixing button functionality