Improved image checking

imported imghdr and used it :)