diff --git a/src/main/java/no/nibio/vips/model/ModelId.java b/src/main/java/no/nibio/vips/model/ModelId.java
index bdbd83c2709e23478ceef890d2c9bf59d244b1ef..8acc67ccae5aaa8675e7819efcc1eb9496cf87c8 100755
--- a/src/main/java/no/nibio/vips/model/ModelId.java
+++ b/src/main/java/no/nibio/vips/model/ModelId.java
@@ -39,7 +39,16 @@ public class ModelId {
         this.setId(theId);
     }
 
-    private void setId(String theId) {
+    private void setId(String theId){
+        theId = theId.trim();
+        if(theId.length() < 10)
+        {
+            theId = theId + new String(new char[10-theId.length()]).replace("\0", "X");
+        }
+        else if(theId.length() > 10)
+        {
+            theId = theId.substring(0, 10);
+        }
         this.id = theId.toCharArray();
     }