Fix buttonIndex