fix #61: crashed when cancelling scanning