fixed (at worst improved) a race condition with button resetting.