Fixed bug with methods not returning
Added support for cancelling a dialog