Images are now written correctly