Improving image file validation