Some fixes and minimal jpeg file creation test.