Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java	(revision 61)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java	(revision 63)
@@ -387,9 +387,9 @@
             String y = geom.getString("y");
             fragment = String.format("xywh=fraction:%s,%s,0,0", x, y);
-        } else if (type.equalsIgnoreCase("point")) {
+        } else if (type.equalsIgnoreCase("rectangle")) {
             String x = geom.getString("x");
             String y = geom.getString("y");
-            String width = shape.getString("width");
-            String height = shape.getString("height");
+            String width = geom.getString("width");
+            String height = geom.getString("height");
             fragment = String.format("xywh=fraction:%s,%s,%s,%s", x, y, width, height);
         } else {
@@ -417,5 +417,4 @@
         String startOffset = range.getString("startOffset");
         String endOffset = range.getString("endOffset");
-
         String fragment = String.format(
                 "xpointer(start-point(string-range(\"%s\",%s,1))/range-to(end-point(string-range(\"%s\",%s,1))))", start,
@@ -560,8 +559,11 @@
         try {
             if (jo.has("ranges")) {
-                JSONObject ranges = jo.getJSONArray("ranges").getJSONObject(0);
-                annot.setFragmentType(FragmentTypes.XPOINTER);
-                String fragment = parseRange(ranges);
-                annot.setTargetFragment(fragment);
+                JSONArray ranges = jo.getJSONArray("ranges");
+                if (ranges.length() > 0) {
+                    JSONObject range = ranges.getJSONObject(0);
+                    annot.setFragmentType(FragmentTypes.XPOINTER);
+                    String fragment = parseRange(range);
+                    annot.setTargetFragment(fragment);
+                }
             }
         } catch (JSONException e) {
@@ -570,8 +572,11 @@
         try {
             if (jo.has("shapes")) {
-                JSONObject shapes = jo.getJSONArray("shapes").getJSONObject(0);
-                annot.setFragmentType(FragmentTypes.AREA);
-                String fragment = parseShape(shapes);
-                annot.setTargetFragment(fragment);
+                JSONArray shapes = jo.getJSONArray("shapes");
+                if (shapes.length() > 0) {
+                    JSONObject shape = shapes.getJSONObject(0);
+                    annot.setFragmentType(FragmentTypes.AREA);
+                    String fragment = parseShape(shape);
+                    annot.setTargetFragment(fragment);
+                }
             }
         } catch (JSONException e) {
@@ -581,13 +586,20 @@
         try {
             if (jo.has("areas")) {
-                JSONObject area = jo.getJSONArray("areas").getJSONObject(0);
-                annot.setFragmentType(FragmentTypes.AREA);
-                String fragment = parseArea(area);
-                annot.setTargetFragment(fragment);
+                JSONArray areas = jo.getJSONArray("areas");
+                if (areas.length() > 0) {
+                    JSONObject area = areas.getJSONObject(0);
+                    annot.setFragmentType(FragmentTypes.AREA);
+                    String fragment = parseArea(area);
+                    annot.setTargetFragment(fragment);
+                }
             }
         } catch (JSONException e) {
             // nothing to do
         }
-
+        // no fragment is an error
+        if (annot.getFragmentType() == null || annot.getTargetFragment() == null) {
+            throw new JSONException("Annotation has no valid target fragment!");
+        }
+        
         /*
          * permissions
@@ -650,5 +662,5 @@
     }
 
-    public float getFloat(String s) {
+    public static float getFloat(String s) {
         try {
             return Float.parseFloat(s);
@@ -657,3 +669,11 @@
         return 0f;
     }
+
+    public static int getInt(String s) {
+        try {
+            return Integer.parseInt(s);
+        } catch (NumberFormatException e) {
+        }
+        return 0;
+    }
 }
