Refine buttons state