Python3 issues in JpegImagePlugin

Fixes #577 + one other python2isim noticed from the test.