Fixed bug in scanner that could cause lock up if trying to scan an
unstable file. Fixes #1