fixed a bug in the condition of allocating new chunks