Fix some bugs in Memory Pool.