FIX: correctly handling external grid declaration