Corrected button handling