fixed num of heaps bug