fixed a heap error in the previous commit