Improvements to image file validation
Updated tests
Fixed python 3 error