Hack to fix "Premature end of JPEG file" errors