fixed memory allocation bug in ndHist.c