better way to handle #parse directives and namespaces. Fix crash when array is empty