update button states code