Fix PAGECOUNT when buf == buflen == 0