Correctly handle scanner that are smaller than expected

Fixes #72.