Fix scanner bugs