handle alert button index correctly when there is no cancel button