fixed an error in button events