uesless bug fix and heapq size improvement