added support for Cancel button in scanner