fixed the heap for a limited size, but it is faster