Added button state transition error checking