improve button state process