Fix error in scanning