ImageWriter tests and a fix.