Added a cancel button and fixed error dismissal