Memory jpeg output fix