improve button handling