patched scan_images.rb