Very ugly hack for jpg files