Bugfix: cancel button index

The cancel button doesn't have to be at index 0. For example if you
don't use a cancel button then a normal button will be at index 0.