Update compare-images.pl

Check undefined