Fix for the cancel bug