Fix crash on cancelling scan

Signed-off-by: Udayan Banerji <ubanerji@alumni.usc.edu>