China posts a surprise factory slowdown