TypeError: Error #1010: A term is undefined and has no properties

i keep getting this error, TypeError: Error #1010: A term is undefined and has no properties.
and debugging points me to this line:

hex.x=modmap[f][2];

where hex is a movie clip as defined here:

var hex:tile = new tile  ; 

(tile is a movie clip on my library)
and f is defined here

var f:int;
for (f=0; f<g; f++);

modmap is a 2d array and gets is values form a previous fuction.

tracing f gives me correct values;

tracing modmap[f] also gives correct values, just like tracing modmap and modmap[f] [1,2,3 etc]

tracing hex gives me [object tile] wich is also correct

the code is supposed to draw a map with tiles based on a predefined array and it does work, yet i keep getting #1010 so sincerely i have no idea what is the problem here and any help you can give me wold be really appreciated.