Fixed ‘Cancel’ function errors