Fixed implementation of isScanning