ncendef error message

Hi,

I wrote a small fortran program to read some data and create a netCDF 
file. Everything seems to be fine until i call ncendf(ncid,errcode). It 
then comes up with an error message saying:

ncendef: xdr_NC_array: loop

any hints?

Thanks, 

ari