Canceled key exception bug fix