update button state logic