Fix bug with failed scan due to overrun of the disk

This caused tests to fail where everything else was just fine.