Heap has limited size now
fixed bug in calculating offsets