getDefinitionByName problem

hi
i am loading class names through an xml file. i use the full package name for example
site_classes.pages.graphic_space.Graphic_space is the string of one class i am trying to load. inside the main class of the application i use the following code to instantiate this class, after having imported the classes as well.

var new_class_name:Class=getDefinitionByName(class_name) as Class;
var my_obj:Object = new new_class_name();
( class_name stores the string name of the class);

when i do this i get the following error :
ReferenceError: Error #1065: Variable Graphic_space is not defined.

but if i hardcode it > var my_obj =new Graphic_space ();
everything works fine.

to make things even more complicated if before the call to getDefinitionByName i place a trace to the full package path of the class for example trace(site_classes.pages.graphic_space.Graphic_space as Class) it works !!!
why the getDefinitionByName function throws an error ??? if there is no trace before ???
can someone help me ?