added a check for when the cursor doesn't leave the button but the mousebutton is released