Made a lot of verifications in order to avoid crashing while attempting to parse images.