fix check for jpeg magic bytes
do not open cascaded responses when image format matches