Fixed bug: NoneType object is not iterable when clicking Cancel button