Even better error checking and test for corrupt image
1.0.2