fixed a memory allocation issue