Fixing to allow scan iterator to hit the end element correctly