Fix image compression, minor cleanups