Fixed a bug of ResourcePool.clear()