Fixed the handling of the "Cancel" button.