diff --git a/src/fr/inrialpes/exmo/ontowrap/jena25/JENAOntologyFactory.java b/src/fr/inrialpes/exmo/ontowrap/jena25/JENAOntologyFactory.java
index 8226b3eea417f75f006b5f3154c5dd36b55cae11..4b6ca350330080b9ade89104b93872864c93703e 100644
--- a/src/fr/inrialpes/exmo/ontowrap/jena25/JENAOntologyFactory.java
+++ b/src/fr/inrialpes/exmo/ontowrap/jena25/JENAOntologyFactory.java
@@ -91,8 +91,10 @@ public class JENAOntologyFactory extends OntologyFactory {
 	    try {
 		onto.setURI(new URI(m.listOntologies().next().getURI()));
 	    } catch (NoSuchElementException nse) {
-		onto.setURI(new URI(m.getNsPrefixURI("")));
-		//onto.setFile(uri);
+		if (m.getNsPrefixURI("")!=null)
+		    onto.setURI(new URI(m.getNsPrefixURI("")));
+		else 
+		    onto.setURI(uri);
 	    }
 	    //onto.setURI(new URI(m.listOntologies()getOntology(null).getURI()));
 	    onto.setOntology(m);