memory allocation issue solved