Added check for scanning incorrect type