diff --git a/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java b/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
index 6563563..30f8e2f 100644
--- a/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
+++ b/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
@@ -41,28 +41,25 @@
         this(secret, new URL(issuer), 72 * 60 * 60);
     }
 
-    public SignedJWT createJWT(User user, Map<String, Object> attr) {
+    public SignedJWT createJWT(User user, Map<String, String> attr) {
         return signContent(user, attr, defaultttl);
     }
 
-    public SignedJWT signContent(User user, Map<String, Object> attr, int ttl) {
+    public SignedJWT signContent(User user, Map<String, String> attr, int ttl) {
         String scopes;
 
         JWTClaimsSet cs = new JWTClaimsSet();
         cs.setIssuerClaim(this.issuer.toString());
 
-        if ((scopes = (String) attr.get(Attributes.SCOPES)) != null) {
-            Map<String, Object> claims = Scopes
-                    .mapOpenIDConnectScopes(scopes, user.getDetails());
-            cs.setCustomClaims(claims);
-            cs.setCustomClaim(Attributes.SCOPES,
-                    ((String) attr.get(Attributes.SCOPES)).toLowerCase());
+        if ((scopes = attr.get(Attributes.SCOPES)) != null) {
+            Scopes claims = Scopes.mapScopes(scopes, user.getDetails());
+            cs.setCustomClaims(claims.toMap());
         }
 
         cs.setSubjectClaim(user.getUsername());
         if (attr.get(Attributes.CLIENT_ID) != null)
             cs.setAudienceClaim(
-                    new String[] { (String) attr.get(Attributes.CLIENT_ID) });
+                    new String[] { attr.get(Attributes.CLIENT_ID) });
         cs.setExpirationTimeClaim(
                 TimeUtils.getNow().plusSeconds(ttl).getMillis());
         SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256),
@@ -163,7 +160,7 @@
         c.setExpirationTime(
                 signedJWT.getJWTClaimsSet().getExpirationTimeClaim());
         c.setToken(idtoken);
-        c.setParameters(signedJWT.getJWTClaimsSet().getCustomClaims());
+        c.addParams(signedJWT.getJWTClaimsSet().getCustomClaims());
         return c;
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index ba271f0..5b961f8 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -26,10 +26,10 @@
 @Getter
 public class KustvaktConfiguration {
 
-    public static final Map<String, Object> KUSTVAKT_USER = new HashMap<>();
+    public static final Map<String, String> KUSTVAKT_USER = new HashMap<>();
 
     static {
-        KUSTVAKT_USER.put(Attributes.ID, 1);
+        KUSTVAKT_USER.put(Attributes.ID, "1");
         KUSTVAKT_USER.put(Attributes.USERNAME, "kustvakt");
         KUSTVAKT_USER.put(Attributes.PASSWORD, "kustvakt2015");
         KUSTVAKT_USER.put(Attributes.EMAIL, "kustvakt@ids-mannheim.de");
diff --git a/src/main/java/de/ids_mannheim/korap/config/Scopes.java b/src/main/java/de/ids_mannheim/korap/config/Scopes.java
index 22567ac..63a3f07 100644
--- a/src/main/java/de/ids_mannheim/korap/config/Scopes.java
+++ b/src/main/java/de/ids_mannheim/korap/config/Scopes.java
@@ -2,6 +2,7 @@
 
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.user.UserDetails;
+import de.ids_mannheim.korap.utils.JsonUtils;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -29,13 +30,12 @@
     private static final Enum[] SERVICE_DEFAULTS = { Scope.account,
             Scope.preferences, Scope.search, Scope.queries };
 
-    public static Map<String, Object> getProfileScopes(
-            Map<String, Object> values) {
-        Map<String, Object> r = new HashMap<>();
+    public static Scopes getProfileScopes(Map<String, Object> values) {
+        Scopes r = new Scopes();
         for (String key : profile) {
             Object v = values.get(key);
             if (v != null)
-                r.put(key, v);
+                r._values.put(key, v);
         }
         return r;
     }
@@ -47,26 +47,44 @@
      * @return
      */
     //todo: test
-    public static Enum[] mapScopes(String scopes) {
+    public static Scope[] mapScopes(String scopes) {
         List<Enum> s = new ArrayList<>();
         for (String value : scopes.split(" "))
             s.add(Scope.valueOf(value.toLowerCase()));
-        return (Enum[]) s.toArray(new Enum[s.size()]);
+        return s.toArray(new Scope[s.size()]);
     }
 
-    public static Map<String, Object> mapOpenIDConnectScopes(String scopes,
-            UserDetails details) {
-        Map<String, Object> m = new HashMap<>();
+    public static Scopes mapScopes(String scopes, UserDetails details) {
+        Scopes m = new Scopes();
+        Map<String, Object> det = details.toMap();
         if (scopes != null && !scopes.isEmpty()) {
-            scopes = scopes.toLowerCase();
-            if (scopes.contains(Scope.email.toString()))
-                m.put(Attributes.EMAIL, details.getEmail());
+            Scope[] scopearr = mapScopes(scopes);
+            for (Scope s : scopearr) {
+                Object v = det.get(s.toString());
+                if (v != null)
+                    m._values.put(s.toString(), v);
+            }
             if (scopes.contains(Scope.profile.toString()))
-                m.putAll(Scopes.getProfileScopes(details.toMap()));
+                m._values.putAll(Scopes.getProfileScopes(det)._values);
+            m._values.put(Attributes.SCOPES, scopes);
         }
         return m;
     }
 
+    private Map<String, Object> _values;
 
+    private Scopes() {
+        this._values = new HashMap<>();
+    }
+
+    public String toEntity() {
+        if (this._values.isEmpty())
+            return "";
+        return JsonUtils.toJSON(this._values);
+    }
+
+    public Map<String, Object> toMap() {
+        return new HashMap<>(this._values);
+    }
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java b/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
index d6d57bf..b2fa818 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
@@ -164,6 +164,18 @@
         }
     }
 
+    @Override
+    public int size() throws KustvaktException {
+        final String sql = "select count(*) from coll_store;";
+        try {
+            return this.jdbcTemplate
+                    .queryForObject(sql, new HashMap<String, Object>(),
+                            Integer.class);
+        }catch (DataAccessException e) {
+            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
+        }
+    }
+
     //todo: adjust to resource id input (batch operation!)
     // fixme: test
     public List<VirtualCollection> getResources(Collection<Object> resources,
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java b/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
index 57b0014..ccc9409 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
@@ -222,4 +222,9 @@
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
+
+    @Override
+    public int size() throws KustvaktException {
+        return -1;
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
index 067abda..03d1b87 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
@@ -93,9 +93,8 @@
         }catch (DataAccessException e) {
             jlog.error("Could not update user settings for user: " + settings
                     .getUserID(), e);
-            throw new dbException(settings.getUserID(), "userSettings",
+            throw new dbException(settings.getUserID(), "user_settings",
                     StatusCodes.DB_UPDATE_FAILED, settings.toString());
-            //            throw new KorAPException(e, StatusCodes.CONNECTION_ERROR);
         }
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java b/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
index 4f6b9e3..6161cdb 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
@@ -47,16 +47,18 @@
 
     @Override
     public boolean checkDatabase() {
+        int size;
         NamedParameterJdbcTemplate tmp = this.getSource();
         try {
-            // todo: use a table that doesnt change!!!!!
-            tmp.queryForObject("select count(id) from korap_users limit 1;",
+            // uses flyway schema table to determine of schema was applied succesfully
+            size = tmp.queryForObject(
+                    "select count(*) from schema_version limit 10;",
                     new HashMap<String, Object>(), Integer.class);
         }catch (Exception e) {
             System.out.println("No database schema found!");
             return false;
         }
-        return true;
+        return size > 0;
     }
 
     @Override
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
index 0aeeaac..53f3a3b 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
@@ -185,4 +185,9 @@
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
+
+    @Override
+    public int size() throws KustvaktException {
+        return -1;
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
index 82d6737..13f29f6 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
@@ -11,7 +11,7 @@
     TokenContext getUserStatus(String authToken) throws
             KustvaktException;
 
-    TokenContext createUserSession(User user, Map<String, Object> attr)
+    TokenContext createUserSession(User user, Map<String, String> attr)
             throws KustvaktException;
 
     void removeUserSession(String token) throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
index f0df181..1d2f9cd 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
@@ -43,18 +43,18 @@
     public abstract User getUser(String username) throws KustvaktException;
 
     public abstract User authenticate(int type, String username,
-            String password, Map<String, Object> attributes)
+            String password, Map<String, String> attributes)
             throws KustvaktException;
 
     public abstract TokenContext createTokenContext(User user,
-            Map<String, Object> attr, String provider_key)
+            Map<String, String> attr, String provider_key)
             throws KustvaktException;
 
     public abstract void logout(TokenContext context) throws KustvaktException;
 
     public abstract void lockAccount(User user) throws KustvaktException;
 
-    public abstract User createUserAccount(Map<String, Object> attributes,
+    public abstract User createUserAccount(Map<String, String> attributes,
             boolean conf_required) throws KustvaktException;
 
     public abstract boolean updateAccount(User user) throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
index b591911..6101861 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
@@ -68,7 +68,7 @@
 
     public String validateEmail(String email) throws KustvaktException;
 
-    public Map<String, Object> validateMap(Map<String, Object> map)
+    public Map<String, String> validateMap(Map<String, String> map)
             throws KustvaktException;
 
     public String validateString(String input) throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java
index c21d941..7b8c58a 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java
@@ -43,7 +43,7 @@
         this.schema = schema;
     }
 
-    public abstract boolean checkDatabase() throws Exception;
+    public abstract boolean checkDatabase();
 
     public abstract void createDatabase() throws IOException;
 
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
index e509b61..cfa4c99 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
@@ -41,4 +41,6 @@
 
     int deleteAll() throws KustvaktException;
 
+    int size() throws KustvaktException;
+
 }
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
index 9f412b1..f5679c8 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
@@ -96,7 +96,7 @@
     }
 
     @Override
-    public Map<String, Object> validateMap(Map<String, Object> map)
+    public Map<String, String> validateMap(Map<String, String> map)
             throws KustvaktException {
         return null;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
index 47c3033..ee8b49b 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
@@ -25,7 +25,6 @@
 import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 public class KustvaktEncryption implements EncryptionIface {
@@ -280,27 +279,27 @@
     }
 
     @Override
-    public Map<String, Object> validateMap(Map<String, Object> map)
+    public Map<String, String> validateMap(Map<String, String> map)
             throws KustvaktException {
-        Map<String, Object> safeMap = new HashMap<>();
+        Map<String, String> safeMap = new HashMap<>();
         if (map != null) {
-            for (Map.Entry<String, Object> entry : map.entrySet()) {
-                Object value = null;
-                if (entry.getValue() instanceof String) {
-                    value = validateString((String) entry.getValue());
+            for (Map.Entry<String, String> entry : map.entrySet()) {
+                //                String value = null;
+                //                if (entry.getValue() instanceof String) {
+                String value = validateString(entry.getValue());
 
-                }else if (entry.getValue() instanceof List) {
-                    List list = (List) entry.getValue();
-                    for (Object v : list) {
-                        if (v instanceof String)
-                            validateString((String) v);
-                    }
-
-                    if (((List) entry.getValue()).size() == 1)
-                        value = list.get(0);
-                    else
-                        value = list;
-                }
+                //                }else if (entry.getValue() instanceof List) {
+                //                    List list = (List) entry.getValue();
+                //                    for (Object v : list) {
+                //                        if (v instanceof String)
+                //                            validateString((String) v);
+                //                    }
+                //
+                //                    if (((List) entry.getValue()).size() == 1)
+                //                        value = list.get(0);
+                //                    else
+                //                        value = list;
+                //                }
                 safeMap.put(entry.getKey(), value);
             }
         }
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java
index 4fb533b..06af664 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java
@@ -11,6 +11,8 @@
 import de.ids_mannheim.korap.security.SecurityPolicy;
 import de.ids_mannheim.korap.user.User;
 
+import java.util.Arrays;
+
 /**
  * @author hanl
  * @date 14/04/2014
@@ -128,26 +130,21 @@
         if (this.rel == null)
             this.rel = Relation.AND;
 
+        System.out.println("CREATING RESOURCES " + Arrays.asList(resources));
+        System.out.println("RESOURCES LENGTH " + resources.length);
         for (int idx = 0; idx < this.resources.length; idx++) {
-            if (parents[idx] != null)
-                resources[idx].setParentID(parents[idx].getPersistentID());
-            SecurityManager manager = SecurityManager
-                    .register(resources[idx], user);
+            try {
+                System.out.println("ITERATING OVER ARRAY " + idx);
+                if (parents[idx] != null)
+                    resources[idx].setParentID(parents[idx].getPersistentID());
+                System.out.println("RUNNING REGISTERING SERVICE ON RESOURCE "
+                        + resources[idx]);
+                SecurityManager manager = SecurityManager
+                        .register(resources[idx], user);
 
-            if (rel.equals(Relation.AND)) {
-                SecurityPolicy policy = new SecurityPolicy()
-                        .setConditions(this.conditions)
-                        .setTarget(resources[idx]).addPermission(permissions)
-                        .setCreator(this.user.getId());
-
-                if (this.context != null)
-                    policy.setContext(this.context);
-
-                manager.addPolicy(policy);
-
-            }else if (rel.equals(Relation.OR)) {
-                for (PolicyCondition c : this.conditions) {
-                    SecurityPolicy policy = new SecurityPolicy().addCondition(c)
+                if (rel.equals(Relation.AND)) {
+                    SecurityPolicy policy = new SecurityPolicy()
+                            .setConditions(this.conditions)
                             .setTarget(resources[idx])
                             .addPermission(permissions)
                             .setCreator(this.user.getId());
@@ -155,18 +152,35 @@
                     if (this.context != null)
                         policy.setContext(this.context);
 
-                    //                    if (this.settings != null) {
-                    //                        ParameterSettingsHandler settings = this.settings
-                    //                                .get(c.getSpecifier());
-                    //                        if (settings != null) {
-                    //                            // fixme: context setting overlap!
-                    //                            policy.setContext(settings.getContext());
-                    //                            manager.addPolicy(policy, settings.getParameters());
-                    //                            continue;
-                    //                        }
-                    //                    }
                     manager.addPolicy(policy);
+
+                }else if (rel.equals(Relation.OR)) {
+                    for (PolicyCondition c : this.conditions) {
+                        SecurityPolicy policy = new SecurityPolicy()
+                                .addCondition(c).setTarget(resources[idx])
+                                .addPermission(permissions)
+                                .setCreator(this.user.getId());
+
+                        if (this.context != null)
+                            policy.setContext(this.context);
+
+                        //todo: ???
+                        //                    if (this.settings != null) {
+                        //                        ParameterSettingsHandler settings = this.settings
+                        //                                .get(c.getSpecifier());
+                        //                        if (settings != null) {
+                        //                            // fixme: context setting overlap!
+                        //                            policy.setContext(settings.getContext());
+                        //                            manager.addPolicy(policy, settings.getParameters());
+                        //                            continue;
+                        //                        }
+                        //                    }
+                        manager.addPolicy(policy);
+                    }
                 }
+            }catch (KustvaktException e) {
+                System.out.println("IF ERROR, LET OTHER RESOURCES RUN ANYWAY!");
+                e.printStackTrace();
             }
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
index 378f087..57c6fe2 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
@@ -686,6 +686,7 @@
                 // that as checkup (may also be manageable via triggers)
                 //                if (this.jdbcTemplate
                 //                        .queryForObject(select, param, Integer.class) == 0)
+                System.out.println("PARAMETER MAP " + param.getValues());
                 sources[idx] = param;
             }
 
@@ -694,8 +695,11 @@
             return this.jdbcTemplate.batchUpdate(insert, sources);
         }catch (DataAccessException e) {
             jlog.error("Operation (INSERT) not possible for '{}' for user '{}'",
-                    condition.toString(), usernames);
-            throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
+                    condition.toString(), usernames, e);
+            throw new KustvaktException(
+                    "Operation (INSERT) not possible for '" + condition
+                            .toString() + "' for user '" + usernames + "'", e,
+                    StatusCodes.CONNECTION_ERROR);
         }
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
index 8fe09ad..f3226ec 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
@@ -277,7 +277,7 @@
 
                 jlog.info("Creating Access Control structure for resource '"
                         + resource.getPersistentID() + "@" + resource.getId()
-                        + "'");
+                        + "', name: " + resource.getName());
                 // storing resource is called twice. first when this is register and later in idsbootstrap to create cstorage entry. how to unify this?
                 ResourceOperationIface iface = p.handlers
                         .get(resource.getClass());
@@ -379,6 +379,11 @@
             }
         }
         this.policies[0].add(policy);
+        try {
+            Thread.sleep(5);
+        }catch (InterruptedException e) {
+            e.printStackTrace();
+        }
     }
 
     public void deletePolicies()
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
index 13e383d..d59e503 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
@@ -11,10 +11,9 @@
 import de.ids_mannheim.korap.user.TokenContext;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.utils.StringUtils;
+import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.Cacheable;
 
 import java.text.ParseException;
 import java.util.Map;
@@ -25,6 +24,9 @@
 public class APIAuthentication implements AuthenticationIface {
 
     private JWTSigner signedToken;
+    private Cache invalided = CacheManager.getInstance()
+            .getCache("id_tokens_inv");
+    private Cache id_tokens = CacheManager.getInstance().getCache("id_tokens");
 
     public APIAuthentication(KustvaktConfiguration bconfig) {
         KustvaktConfiguration config = bconfig;
@@ -32,22 +34,31 @@
                 config.getIssuer(), config.getTokenTTL());
     }
 
-    @Cacheable(value = "id_tokens", key = "#authToken")
+    //    @Cacheable(value = "id_tokens", key = "#authToken")
+    // todo: test
     @Override
     public TokenContext getUserStatus(String authToken)
             throws KustvaktException {
-        try {
-            authToken = StringUtils.stripTokenType(authToken);
-            TokenContext c = signedToken.getTokenContext(authToken);
-            c.setTokenType(Attributes.API_AUTHENTICATION);
-            return c;
-        }catch (JOSEException | ParseException e) {
-            throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
-        }
+        TokenContext context;
+        Element e = id_tokens.get(authToken);
+        Element ein = invalided.get(authToken);
+        if (e == null && ein == null) {
+            try {
+                authToken = StringUtils.stripTokenType(authToken);
+                context = signedToken.getTokenContext(authToken);
+                context.setTokenType(Attributes.API_AUTHENTICATION);
+            }catch (JOSEException | ParseException ex) {
+                throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
+            }
+        }else if (ein == null) {
+            context = (TokenContext) e.getObjectValue();
+        }else
+            throw new KustvaktException(StatusCodes.EXPIRED);
+        return context;
     }
 
     @Override
-    public TokenContext createUserSession(User user, Map<String, Object> attr)
+    public TokenContext createUserSession(User user, Map<String, String> attr)
             throws KustvaktException {
         TokenContext c = new TokenContext();
         c.setUsername(user.getUsername());
@@ -59,17 +70,18 @@
         }
         c.setTokenType(Attributes.API_AUTHENTICATION);
         c.setToken(jwt.serialize());
-        CacheManager.getInstance().getCache("id_tokens")
-                .put(new Element(c.getToken(), c));
+        id_tokens.put(new Element(c.getToken(), c));
 
         return c;
     }
 
     // todo: cache and set expiration to token expiration. if token in that cache, it is not to be used anymore!
-    @CacheEvict(value = "id_tokens", key = "#token")
+    // fixme: dont use annotations but function calls
+    //    @CacheEvict(value = "id_tokens", key = "#token")
     @Override
     public void removeUserSession(String token) throws KustvaktException {
         // invalidate token!
+        invalided.put(new Element(token, null));
     }
 
     @Override
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java b/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
index fda1e9f..4470a30 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
@@ -3,6 +3,7 @@
 import de.ids_mannheim.korap.config.BeanConfiguration;
 import de.ids_mannheim.korap.config.Scopes;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.interfaces.AuthenticationIface;
 import de.ids_mannheim.korap.interfaces.EncryptionIface;
 import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
@@ -73,13 +74,14 @@
 
     // not supported!
     @Override
-    public TokenContext createUserSession(User user, Map<String, Object> attr)
+    public TokenContext createUserSession(User user, Map<String, String> attr)
             throws KustvaktException {
         return null;
     }
 
     @Override
     public void removeUserSession(String token) throws KustvaktException {
+        throw new KustvaktException(StatusCodes.NOT_SUPPORTED);
     }
 
     @Override
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
index 854c81d..4576435 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
@@ -74,8 +74,8 @@
                     "token type not defined or found", "token_type");
 
         TokenContext context = provider.getUserStatus(token);
-        if (!matchStatus(host, useragent, context))
-            provider.removeUserSession(token);
+        //        if (!matchStatus(host, useragent, context))
+        //            provider.removeUserSession(token);
         return context;
     }
 
@@ -127,7 +127,7 @@
      * @throws KustvaktException
      */
     public User authenticate(int type, String username, String password,
-            Map<String, Object> attributes) throws KustvaktException {
+            Map<String, String> attributes) throws KustvaktException {
         User user;
         switch (type) {
             case 1:
@@ -145,7 +145,7 @@
     }
 
     @CachePut(value = "users", key = "#user.getUsername()")
-    public TokenContext createTokenContext(User user, Map<String, Object> attr,
+    public TokenContext createTokenContext(User user, Map<String, String> attr,
             String provider_key) throws KustvaktException {
         AuthenticationIface provider = getProvider(provider_key,
                 Attributes.API_AUTHENTICATION);
@@ -156,12 +156,13 @@
         TokenContext context = provider.createUserSession(user, attr);
         if (context == null)
             throw new KustvaktException(StatusCodes.NOT_SUPPORTED);
-        context.setUserAgent((String) attr.get(Attributes.USER_AGENT));
+        context.setUserAgent(attr.get(Attributes.USER_AGENT));
         context.setHostAddress(Attributes.HOST);
         return context;
     }
 
     //todo: test
+    @Deprecated
     private boolean matchStatus(String host, String useragent,
             TokenContext context) {
         if (host.equals(context.getHostAddress())) {
@@ -171,7 +172,7 @@
         return false;
     }
 
-    private User authenticateShib(Map<String, Object> attributes)
+    private User authenticateShib(Map<String, String> attributes)
             throws KustvaktException {
         // todo use persistent id, since eppn is not unique
         String eppn = (String) attributes.get(Attributes.EPPN);
@@ -192,8 +193,8 @@
 
     //todo: what if attributes null?
     private User authenticate(String username, String password,
-            Map<String, Object> attr) throws KustvaktException {
-        Map<String, Object> attributes = crypto.validateMap(attr);
+            Map<String, String> attr) throws KustvaktException {
+        Map<String, String> attributes = crypto.validateMap(attr);
         String safeUS;
         User unknown;
         // just to make sure that the plain password does not appear anywhere in the logs!
@@ -310,7 +311,8 @@
                     null);
 
             if (provider == null) {
-
+                //todo:
+                return;
             }
             provider.removeUserSession(context.getToken());
         }catch (KustvaktException e) {
@@ -455,9 +457,9 @@
      * @throws KustvaktException
      */
     //fixme: remove clientinfo object (not needed), use json representation to get stuff
-    public User createUserAccount(Map<String, Object> attributes,
+    public User createUserAccount(Map<String, String> attributes,
             boolean conf_required) throws KustvaktException {
-        Map<String, Object> safeMap = crypto.validateMap(attributes);
+        Map<String, String> safeMap = crypto.validateMap(attributes);
         if (safeMap.get(Attributes.USERNAME) == null || ((String) safeMap
                 .get(Attributes.USERNAME)).isEmpty())
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
@@ -504,11 +506,11 @@
     }
 
     //todo:
-    private ShibUser createShibbUserAccount(Map<String, Object> attributes)
+    private ShibUser createShibbUserAccount(Map<String, String> attributes)
             throws KustvaktException {
         jlog.debug("creating shibboleth user account for user attr: {}",
                 attributes);
-        Map<String, Object> safeMap = crypto.validateMap(attributes);
+        Map<String, String> safeMap = crypto.validateMap(attributes);
 
         //todo eppn non-unique.join with idp or use persistent_id as username identifier
         ShibUser user = User.UserFactory
@@ -517,7 +519,7 @@
                         (String) safeMap.get(Attributes.CN));
         user.setAffiliation((String) safeMap.get(Attributes.EDU_AFFIL));
         UserDetails det = UserDetails
-                .newDetailsIterator(new HashMap<String, Object>());
+                .newDetailsIterator(new HashMap<String, String>());
         user.setDetails(det);
         user.setSettings(new UserSettings());
         user.setAccountCreation(TimeUtils.getNow().getMillis());
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
index 3f0ebe4..a1871c9 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
@@ -44,9 +44,9 @@
     }
 
     @Override
-    public TokenContext createUserSession(User user, Map<String, Object> attr)
+    public TokenContext createUserSession(User user, Map<String, String> attr)
             throws KustvaktException {
-        String cl_secret = (String) attr.get(Attributes.CLIENT_SECRET);
+        String cl_secret = attr.get(Attributes.CLIENT_SECRET);
         if (cl_secret == null)
             throw new KustvaktException(StatusCodes.REQUEST_INVALID);
         attr.remove(cl_secret);
diff --git a/src/main/java/de/ids_mannheim/korap/user/TokenContext.java b/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
index e07cdda..9eeff3a 100644
--- a/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
+++ b/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
@@ -6,8 +6,10 @@
 import lombok.AccessLevel;
 import lombok.Data;
 import lombok.Getter;
+import lombok.Setter;
 import org.joda.time.DateTime;
 
+import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
@@ -17,7 +19,7 @@
  * @date 27/01/2014
  */
 @Data
-public class TokenContext implements java.security.Principal {
+public class TokenContext implements java.security.Principal, Serializable {
 
     /**
      * session relevant data. Are never persisted into a database
@@ -30,7 +32,8 @@
     private boolean secureRequired;
 
     @Getter(AccessLevel.PRIVATE)
-    private Map<String, Object> parameters;
+    @Setter(AccessLevel.PRIVATE)
+    private Map<String, String> parameters;
     private String hostAddress;
     private String userAgent;
 
@@ -51,7 +54,7 @@
         return m;
     }
 
-    public Map<String, Object> params() {
+    public Map<String, String> params() {
         return new HashMap<>(parameters);
     }
 
@@ -68,6 +71,11 @@
         this.parameters.put(key, value);
     }
 
+    public void addParams(Map<String, Object> map) {
+        for (Map.Entry<String, Object> e : map.entrySet())
+            this.parameters.put(e.getKey(), String.valueOf(e.getValue()));
+    }
+
     public void removeContextParameter(String key) {
         this.parameters.remove(key);
     }
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
index d76790e..4051436 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
@@ -40,29 +40,29 @@
         setPrivateUsage(true);
     }
 
-    public static UserDetails newDetailsIterator(Map<String, Object> d) {
+    public static UserDetails newDetailsIterator(Map<String, String> d) {
         UserDetails details = new UserDetails();
-        Map<String, Object> detailMap = new CaseInsensitiveMap(d);
+        Map<String, String> detailMap = new CaseInsensitiveMap(d);
 
         if (!detailMap.isEmpty()) {
-            details.setFirstName((String) detailMap.get(Attributes.FIRSTNAME));
-            details.setLastName((String) detailMap.get(Attributes.LASTNAME));
-            details.setPhone((String) detailMap.get(Attributes.PHONE));
-            details.setEmail((String) detailMap.get(Attributes.EMAIL));
-            details.setGender((String) detailMap.get(Attributes.GENDER));
-            details.setAddress((String) detailMap.get(Attributes.ADDRESS));
-            details.setCountry((String) detailMap.get(Attributes.COUNTRY));
-            details.setInstitution(
-                    (String) detailMap.get(Attributes.INSTITUTION));
+            details.setFirstName(detailMap.get(Attributes.FIRSTNAME));
+            details.setLastName(detailMap.get(Attributes.LASTNAME));
+            details.setPhone(detailMap.get(Attributes.PHONE));
+            details.setEmail(detailMap.get(Attributes.EMAIL));
+            details.setGender(detailMap.get(Attributes.GENDER));
+            details.setAddress(detailMap.get(Attributes.ADDRESS));
+            details.setCountry(detailMap.get(Attributes.COUNTRY));
+            details.setInstitution(detailMap.get(Attributes.INSTITUTION));
             details.setPrivateUsage(
                     detailMap.get(Attributes.PRIVATE_USAGE) == null ?
                             true :
-                            (Boolean) detailMap.get(Attributes.PRIVATE_USAGE));
+                            Boolean.valueOf(
+                                    detailMap.get(Attributes.PRIVATE_USAGE)));
         }
         return details;
     }
 
-    public void updateDetails(Map<String, Object> d) {
+    public void updateDetails(Map<String, String> d) {
         Map<String, Object> detailMap = new CaseInsensitiveMap(d);
 
         if (!detailMap.isEmpty()) {
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
index c16f617..7295505 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
@@ -196,29 +196,43 @@
     }
 
     public void updateStringSettings(Map<String, String> m) {
-        this.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
+        if (m.get(Attributes.FILENAME_FOR_EXPORT) != null)
+            this.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
         //        this.setItemForSimpleAnnotation(
         //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
-        this.setLeftContextItemForExport(
-                m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
-        this.setLeftContextSizeForExport(Integer.valueOf(
-                m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
-        this.setLocale(m.get(Attributes.LOCALE));
-        this.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
-        this.setLeftContextSize(
-                Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
-        this.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
-        this.setRightContextItemForExport(
-                m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
-        this.setRightContextSize(
-                Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
-        this.setRightContextSizeForExport(Integer.valueOf(
-                m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
-        this.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
-        this.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
-        this.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
-        this.setMetadataQueryExpertModus(
-                Boolean.valueOf(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
+        if (m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT) != null)
+            this.setLeftContextItemForExport(
+                    m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
+        if (m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT) != null)
+            this.setLeftContextSizeForExport(Integer.valueOf(
+                    m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
+        if (m.get(Attributes.LOCALE) != null)
+            this.setLocale(m.get(Attributes.LOCALE));
+        if (m.get(Attributes.LEFT_CONTEXT_ITEM) != null)
+            this.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
+        if (m.get(Attributes.LEFT_CONTEXT_SIZE) != null)
+            this.setLeftContextSize(
+                    Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
+        if (m.get(Attributes.RIGHT_CONTEXT_ITEM) != null)
+            this.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
+        if (m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT) != null)
+            this.setRightContextItemForExport(
+                    m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
+        if (m.get(Attributes.RIGHT_CONTEXT_SIZE) != null)
+            this.setRightContextSize(
+                    Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
+        if (m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT) != null)
+            this.setRightContextSizeForExport(Integer.valueOf(
+                    m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
+        if (m.get(Attributes.SELECTED_COLLECTION) != null)
+            this.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
+        if (m.get(Attributes.QUERY_LANGUAGE) != null)
+            this.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
+        if (m.get(Attributes.PAGE_LENGTH) != null)
+            this.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
+        if (m.get(Attributes.METADATA_QUERY_EXPERT_MODUS) != null)
+            this.setMetadataQueryExpertModus(Boolean.valueOf(
+                    m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
         //        this.setSearchSettingsTab(
         //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
         //        this.setSelectedGraphType(
@@ -226,57 +240,85 @@
         //        this.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
         //        this.setSelectedViewForSearchResults(
         //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
-
-        this.setCollectData(
-                Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
-        this.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
-        this.setDefaultLemmafoundry(m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
-        this.setDefaultConstfoundry(m.get(Attributes.DEFAULT_CONST_FOUNDRY));
-        this.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
+        if (m.get(Attributes.COLLECT_AUDITING_DATA) != null)
+            this.setCollectData(
+                    Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
+        if (m.get(Attributes.DEFAULT_POS_FOUNDRY) != null)
+            this.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
+        if (m.get(Attributes.DEFAULT_LEMMA_FOUNDRY) != null)
+            this.setDefaultLemmafoundry(
+                    m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
+        if (m.get(Attributes.DEFAULT_CONST_FOUNDRY) != null)
+            this.setDefaultConstfoundry(
+                    m.get(Attributes.DEFAULT_CONST_FOUNDRY));
+        if (m.get(Attributes.DEFAULT_REL_FOUNDRY) != null)
+            this.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
     }
 
     public void updateObjectSettings(Map<String, Object> m) {
-        this.setFileNameForExport(
-                (String) m.get(Attributes.FILENAME_FOR_EXPORT));
+        if (m.get(Attributes.FILENAME_FOR_EXPORT) != null)
+            this.setFileNameForExport(
+                    (String) m.get(Attributes.FILENAME_FOR_EXPORT));
         //        this.setItemForSimpleAnnotation(
-        //                (Integer) m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION));
-        this.setLeftContextItemForExport(
-                (String) m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
-        this.setLeftContextSizeForExport(
-                (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT));
-        this.setLocale((String) m.get(Attributes.LOCALE));
-        this.setLeftContextItem((String) m.get(Attributes.LEFT_CONTEXT_ITEM));
-        this.setLeftContextSize((Integer) m.get(Attributes.LEFT_CONTEXT_SIZE));
-        this.setRightContextItem((String) m.get(Attributes.RIGHT_CONTEXT_ITEM));
-        this.setRightContextItemForExport(
-                (String) m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
-        this.setRightContextSize(
-                (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE));
-        this.setRightContextSizeForExport(
-                (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT));
-        this.setSelectedCollection(
-                (String) m.get(Attributes.SELECTED_COLLECTION));
-        this.setQueryLanguage((String) m.get(Attributes.QUERY_LANGUAGE));
-        this.setPageLength((Integer) m.get(Attributes.PAGE_LENGTH));
-        this.setMetadataQueryExpertModus(
-                (Boolean) m.get(Attributes.METADATA_QUERY_EXPERT_MODUS));
+        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
+        if (m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT) != null)
+            this.setLeftContextItemForExport(
+                    (String) m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
+        if (m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT) != null)
+            this.setLeftContextSizeForExport(Integer.valueOf(
+                    (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
+        if (m.get(Attributes.LOCALE) != null)
+            this.setLocale((String) m.get(Attributes.LOCALE));
+        if (m.get(Attributes.LEFT_CONTEXT_ITEM) != null)
+            this.setLeftContextItem(
+                    (String) m.get(Attributes.LEFT_CONTEXT_ITEM));
+        if (m.get(Attributes.LEFT_CONTEXT_SIZE) != null)
+            this.setLeftContextSize(Integer.valueOf(
+                    (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE)));
+        if (m.get(Attributes.RIGHT_CONTEXT_ITEM) != null)
+            this.setRightContextItem(
+                    (String) m.get(Attributes.RIGHT_CONTEXT_ITEM));
+        if (m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT) != null)
+            this.setRightContextItemForExport(
+                    (String) m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
+        if (m.get(Attributes.RIGHT_CONTEXT_SIZE) != null)
+            this.setRightContextSize(Integer.valueOf(
+                    (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE)));
+        if (m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT) != null)
+            this.setRightContextSizeForExport(Integer.valueOf(
+                    (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
+        if (m.get(Attributes.SELECTED_COLLECTION) != null)
+            this.setSelectedCollection(
+                    (String) m.get(Attributes.SELECTED_COLLECTION));
+        if (m.get(Attributes.QUERY_LANGUAGE) != null)
+            this.setQueryLanguage((String) m.get(Attributes.QUERY_LANGUAGE));
+        if (m.get(Attributes.PAGE_LENGTH) != null)
+            this.setPageLength((Integer) m.get(Attributes.PAGE_LENGTH));
+        if (m.get(Attributes.METADATA_QUERY_EXPERT_MODUS) != null)
+            this.setMetadataQueryExpertModus(Boolean.valueOf(
+                    (Boolean) m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
         //        this.setSearchSettingsTab(
-        //                (Integer) m.get(Attributes.SEARCH_SETTINGS_TAB));
+        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
         //        this.setSelectedGraphType(
-        //                (Integer) m.get(Attributes.SELECTED_GRAPH_TYPE));
-        //        this.setSelectedSortType((String) m.get(Attributes.SELECTED_SORT_TYPE));
+        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
+        //        this.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
         //        this.setSelectedViewForSearchResults(
-        //                (String) m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
-
-        this.setCollectData((Boolean) m.get(Attributes.COLLECT_AUDITING_DATA));
-        this.setDefaultPOSfoundry(
-                (String) m.get(Attributes.DEFAULT_POS_FOUNDRY));
-        this.setDefaultLemmafoundry(
-                (String) m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
-        this.setDefaultConstfoundry(
-                (String) m.get(Attributes.DEFAULT_CONST_FOUNDRY));
-        this.setDefaultRelfoundry(
-                (String) m.get(Attributes.DEFAULT_REL_FOUNDRY));
+        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
+        if (m.get(Attributes.COLLECT_AUDITING_DATA) != null)
+            this.setCollectData(
+                    (Boolean) m.get(Attributes.COLLECT_AUDITING_DATA));
+        if (m.get(Attributes.DEFAULT_POS_FOUNDRY) != null)
+            this.setDefaultPOSfoundry(
+                    (String) m.get(Attributes.DEFAULT_POS_FOUNDRY));
+        if (m.get(Attributes.DEFAULT_LEMMA_FOUNDRY) != null)
+            this.setDefaultLemmafoundry(
+                    (String) m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
+        if (m.get(Attributes.DEFAULT_CONST_FOUNDRY) != null)
+            this.setDefaultConstfoundry(
+                    (String) m.get(Attributes.DEFAULT_CONST_FOUNDRY));
+        if (m.get(Attributes.DEFAULT_REL_FOUNDRY) != null)
+            this.setDefaultRelfoundry(
+                    (String) m.get(Attributes.DEFAULT_REL_FOUNDRY));
     }
 
     //loadSubTypes from configuration?
@@ -294,7 +336,7 @@
         this.setRightContextSizeForExport(100);
         // persistent id for wikipedia!
         // fixme: deprecation warning!
-         this.setSelectedCollection(
+        this.setSelectedCollection(
                 "ZGU0ZTllNTFkYzc3M2VhZmViYzdkYWE2ODI5NDc3NTk4NGQ1YThhOTMwOTNhOWYxNWMwN2M3Y2YyZmE3N2RlNQ==");
         this.setQueryLanguage("COSMAS2");
         this.setPageLength(25);
diff --git a/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java b/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java
index 8b22d25..d3b5028 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java
@@ -48,6 +48,8 @@
     }
 
     public SqlBuilder params(String... values) {
+        if (values.length != fields.length)
+            return this;
         if (this.buffer.lastIndexOf("INSERT INTO") != -1) {
             this.buffer.append(" (");
             for (int i = 0; i < this.fields.length; i++) {
diff --git a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
index e8a6311..560970d 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
@@ -76,7 +76,7 @@
             user.setPassword(pass);
         }else {
             user = User.UserFactory.getUser(username);
-            Map<String, Object> vals = new HashMap<>();
+            Map<String, String> vals = new HashMap<>();
             for (Map.Entry e : p.entrySet()) {
                 String key = e.getKey().toString().split("\\.", 2)[1];
                 vals.put(key, e.getValue().toString());
diff --git a/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java b/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
index 880c9d9..8bdfb7d 100644
--- a/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
+++ b/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
@@ -5,7 +5,9 @@
 import com.sun.jersey.spi.container.servlet.ServletContainer;
 import de.ids_mannheim.korap.config.BeanConfiguration;
 import de.ids_mannheim.korap.config.KustvaktClassLoader;
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
 import de.ids_mannheim.korap.web.service.BootupInterface;
 import lombok.Getter;
 import lombok.Setter;
@@ -28,6 +30,7 @@
 public class KustvaktBaseServer {
 
     public static void main(String[] args) throws Exception {
+        KustvaktConfiguration.loadLog4jLogger();
         KustvaktBaseServer server = new KustvaktBaseServer();
         KustvaktArgs kargs = server.readAttributes(args);
 
@@ -38,7 +41,7 @@
 
         kargs.setRootPackages(
                 new String[] { "de.ids_mannheim.korap.web.service.light" });
-        server.runPreStart();
+
         server.startServer(kargs);
     }
 
@@ -69,40 +72,50 @@
                     System.out.println(b.toString());
                     System.out.println();
                     break;
+                case "--init":
+                    kargs.init = true;
+                    break;
             }
         }
         return kargs;
     }
 
-    public static void runPreStart() {
+    public void runPreStart() {
         Set<Class<? extends BootupInterface>> set = KustvaktClassLoader
                 .loadSubTypes(BootupInterface.class);
 
         List<BootupInterface> list = new ArrayList<>(set.size());
 
-        for (Class cl : set) {
-            BootupInterface iface;
-            try {
-                iface = (BootupInterface) cl.newInstance();
-                if (iface.position() == -1 | iface.position() > set.size())
-                    list.add(iface);
-                else
-                    list.add(0, iface);
-            }catch (InstantiationException | IllegalAccessException e) {
-                continue;
+        PersistenceClient client = BeanConfiguration.getBeans()
+                .getPersistenceClient();
+        if (client.checkDatabase()) {
+            for (Class cl : set) {
+                BootupInterface iface;
+                try {
+                    iface = (BootupInterface) cl.newInstance();
+                    if (iface.position() == -1 | iface.position() > set.size())
+                        list.add(iface);
+                    else
+                        list.add(0, iface);
+                }catch (InstantiationException | IllegalAccessException e) {
+                    continue;
+                }
             }
-        }
-        System.out.println("Found boot loading interfaces: " + list);
-        for (BootupInterface iface : list) {
-            try {
-                iface.load();
-            }catch (KustvaktException e) {
-                // don't do anything!
+            System.out.println("Found boot loading interfaces: " + list);
+            for (BootupInterface iface : list) {
+                try {
+                    iface.load();
+                }catch (KustvaktException e) {
+                    // don't do anything!
+                }
             }
         }
     }
 
     protected void startServer(KustvaktArgs kargs) {
+        if (kargs.init)
+            runPreStart();
+
         if (kargs.port == -1)
             kargs.setPort(
                     BeanConfiguration.getBeans().getConfiguration().getPort());
@@ -161,6 +174,7 @@
         private int port;
         private SslContextFactory sslContext;
         private String[] rootPackages;
+        private boolean init;
 
         public KustvaktArgs() {
             this.port = -1;
@@ -168,6 +182,7 @@
             this.debug = false;
             this.config = null;
             this.properties = null;
+            this.init = false;
         }
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java b/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
index a4d753a..2982c8a 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
@@ -20,51 +20,52 @@
 
     @Override
     public void load() throws KustvaktException {
-        int uid = (Integer) KustvaktConfiguration.KUSTVAKT_USER
-                .get(Attributes.ID);
+        if (BeanConfiguration.hasContext()) {
+            CollectionDao dao = new CollectionDao(
+                    BeanConfiguration.getBeans().getPersistenceClient());
 
-        User user = User.UserFactory
-                .toUser(KustvaktConfiguration.KUSTVAKT_USER);
+            int uid = Integer.valueOf(
+                    KustvaktConfiguration.KUSTVAKT_USER.get(Attributes.ID));
 
-        //todo: load default collections!
-        CollectionQueryBuilder3 bui = new CollectionQueryBuilder3();
-        bui.addQuery("creationDate since 1775");
+            User user = User.UserFactory
+                    .toUser(KustvaktConfiguration.KUSTVAKT_USER);
 
-        VirtualCollection c1 = ResourceFactory
-                .createCollection("Weimarer Werke", bui.toJSON(), uid);
-        c1.setDescription("Goethe-Werke in Weimar (seit 1775)");
+            //todo: load default collections!
+            CollectionQueryBuilder3 bui = new CollectionQueryBuilder3();
+            bui.addQuery("creationDate since 1775");
 
-        bui = new CollectionQueryBuilder3();
-        bui.addQuery("textType = Aphorismus");
+            VirtualCollection c1 = ResourceFactory
+                    .createCollection("Weimarer Werke", bui.toJSON(), uid);
+            c1.setDescription("Goethe-Werke in Weimar (seit 1775)");
 
-        VirtualCollection c2 = ResourceFactory
-                .createCollection("Aphorismen", bui.toJSON(), uid);
-        c2.setDescription("Aphorismentexte Goethes");
+            bui = new CollectionQueryBuilder3();
+            bui.addQuery("textType = Aphorismus");
 
-        bui = new CollectionQueryBuilder3();
-        bui.addQuery("title ~ \"Werther\"");
+            VirtualCollection c2 = ResourceFactory
+                    .createCollection("Aphorismen", bui.toJSON(), uid);
+            c2.setDescription("Aphorismentexte Goethes");
 
-        VirtualCollection c3 = ResourceFactory
-                .createCollection("Werther", bui.toJSON(), uid);
-        c3.setDescription("Goethe - Die Leiden des jungen Werther");
+            bui = new CollectionQueryBuilder3();
+            bui.addQuery("title ~ \"Werther\"");
 
-        CollectionDao dao = new CollectionDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+            VirtualCollection c3 = ResourceFactory
+                    .createCollection("Werther", bui.toJSON(), uid);
+            c3.setDescription("Goethe - Die Leiden des jungen Werther");
 
-        dao.storeResource(c1, user);
-        dao.storeResource(c2, user);
-        dao.storeResource(c3, user);
+            dao.storeResource(c1, user);
+            dao.storeResource(c2, user);
+            dao.storeResource(c3, user);
 
-        PolicyBuilder b = new PolicyBuilder(user);
-        b.setPermissions(Permissions.PERMISSIONS.ALL);
-        b.setResources(c1, c2, c3);
-        b.setConditions("public");
-        b.create();
-
+            PolicyBuilder b = new PolicyBuilder(user);
+            b.setPermissions(Permissions.PERMISSIONS.ALL);
+            b.setResources(c1, c2, c3);
+            b.setConditions("public");
+            b.create();
+        }
     }
 
     @Override
     public int position() {
-        return 1;
+        return -1;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java b/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java
index 29dc462..2a76686 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java
@@ -26,35 +26,37 @@
 
     @Override
     public void load() throws KustvaktException {
-        PersistenceClient cl = BeanConfiguration.getBeans()
-                .getPersistenceClient();
-        Set<ResourceOperationIface> ifaces = new HashSet<>();
-        ifaces.add(new ResourceDao(cl));
-        ifaces.add(new CollectionDao(cl));
+        if (BeanConfiguration.hasContext()) {
+            PersistenceClient cl = BeanConfiguration.getBeans()
+                    .getPersistenceClient();
+            Set<ResourceOperationIface> ifaces = new HashSet<>();
+            ifaces.add(new ResourceDao(cl));
+            ifaces.add(new CollectionDao(cl));
 
-        SecurityManager.setProviders(new PolicyDao(cl),
-                BeanConfiguration.getBeans().getEncryption(), ifaces);
-        ResourceFinder.setProviders(new PolicyDao(cl));
+            SecurityManager.setProviders(new PolicyDao(cl),
+                    BeanConfiguration.getBeans().getEncryption(), ifaces);
+            ResourceFinder.setProviders(new PolicyDao(cl));
 
-        User user = User.UserFactory
-                .toUser(KustvaktConfiguration.KUSTVAKT_USER);
-        PolicyBuilder builder = new PolicyBuilder(user);
-        builder.addCondition("public");
-        builder.setResources(new Corpus("GOE", user.getId()));
-        builder.setPermissions(Permissions.PERMISSIONS.ALL);
-        builder.create();
+            User user = User.UserFactory
+                    .toUser(KustvaktConfiguration.KUSTVAKT_USER);
+            PolicyBuilder builder = new PolicyBuilder(user);
+            builder.addCondition("public");
+            builder.setResources(new Corpus("GOE", user.getId()));
+            builder.setPermissions(Permissions.PERMISSIONS.ALL);
+            builder.create();
 
-        // redundant if user is the user who created the condition for the resource
-        //        try {
-        //            ConditionManagement cm = new ConditionManagement(user);
-        ////            cm.addUser(user.getUsername(), new PolicyCondition("public"), true);
-        //        }catch (KustvaktException e) {
-        //            e.printStackTrace();
-        //        }
+            // redundant if user is the user who created the condition for the resource
+            //        try {
+            //            ConditionManagement cm = new ConditionManagement(user);
+            ////            cm.addUser(user.getUsername(), new PolicyCondition("public"), true);
+            //        }catch (KustvaktException e) {
+            //            e.printStackTrace();
+            //        }
+        }
     }
 
     @Override
     public int position() {
-        return -1;
+        return 1;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java b/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java
index 898b303..04ecd95 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java
@@ -3,7 +3,6 @@
 import de.ids_mannheim.korap.config.BeanConfiguration;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.handlers.EntityDao;
 
 /**
  * @author hanl
@@ -12,14 +11,7 @@
 public class UserLoader implements BootupInterface {
     @Override
     public void load() throws KustvaktException {
-        boolean r = BeanConfiguration.hasContext();
-        if (r) {
-            EntityDao dao = new EntityDao(
-                    BeanConfiguration.getBeans().getPersistenceClient());
-
-            if (dao.size() > 0)
-                return;
-
+        if (BeanConfiguration.hasContext()) {
             BeanConfiguration.getBeans().getAuthenticationManager()
                     .createUserAccount(KustvaktConfiguration.KUSTVAKT_USER,
                             false);
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java
index a357c67..f53c816 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java
@@ -72,7 +72,6 @@
         return Response.ok(JsonUtils.toJSON(m)).build();
     }
 
-
     // fixme: moved to user
     @GET
     @Path("status")
@@ -109,10 +108,9 @@
         if (values[0].equalsIgnoreCase("null") | values[1]
                 .equalsIgnoreCase("null"))
             // is actual an invalid request
-            throw KustvaktResponseHandler
-                    .throwit(StatusCodes.REQUEST_INVALID);
+            throw KustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
 
-        Map<String, Object> attr = new HashMap<>();
+        Map<String, String> attr = new HashMap<>();
         if (scopes != null && !scopes.isEmpty())
             attr.put(Attributes.SCOPES, scopes);
         attr.put(Attributes.HOST, host);
@@ -175,10 +173,9 @@
 
         if (values[0].equalsIgnoreCase("null") | values[1]
                 .equalsIgnoreCase("null"))
-            throw KustvaktResponseHandler
-                    .throwit(StatusCodes.REQUEST_INVALID);
+            throw KustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
 
-        Map<String, Object> attr = new HashMap<>();
+        Map<String, String> attr = new HashMap<>();
         attr.put(Attributes.HOST, host);
         attr.put(Attributes.USER_AGENT, agent);
         TokenContext context;
@@ -207,7 +204,7 @@
         // the shibfilter decrypted the values
         // define default provider for returned access token strategy?!
 
-        Map<String, Object> attr = new HashMap<>();
+        Map<String, String> attr = new HashMap<>();
         attr.put(Attributes.HOST, host);
         attr.put(Attributes.USER_AGENT, agent);
 
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
index a73ec3a..11fc0b3 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
@@ -137,7 +137,7 @@
         // json format with scope callback parameter
         // todo: add other scopes as well!
         return Response.ok(JsonUtils.toJSON(Scopes
-                .mapOpenIDConnectScopes(scopes, user.getDetails()))).build();
+                .mapScopes(scopes, user.getDetails()))).build();
     }
 
     @GET
@@ -172,7 +172,7 @@
             @Context SecurityContext context,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
-            MultivaluedMap<String, Object> form)
+            MultivaluedMap<String, String> form)
             throws OAuthSystemException, URISyntaxException {
         // user needs to be authenticated to this service!
         TokenContext c = (TokenContext) context.getUserPrincipal();
@@ -184,7 +184,7 @@
                     new MD5Generator());
             User user;
 
-            Map<String, Object> attr = new HashMap<>();
+            Map<String, String> attr = new HashMap<>();
             attr.put(Attributes.HOST, host);
             attr.put(Attributes.USER_AGENT, agent);
             attr.put(Attributes.USERNAME, c.getUsername());
@@ -436,7 +436,7 @@
                         .entity(res.getBody()).build();
             }
 
-            Map<String, Object> attr = new HashMap<>();
+            Map<String, String> attr = new HashMap<>();
             attr.put(Attributes.HOST, host);
             attr.put(Attributes.USER_AGENT, agent);
             attr.put(Attributes.SCOPES,
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java
index dceb241..1b162dd 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java
@@ -12,7 +12,6 @@
 import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
 import de.ids_mannheim.korap.user.*;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
 import de.ids_mannheim.korap.utils.StringUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import de.ids_mannheim.korap.web.KustvaktServer;
@@ -23,6 +22,7 @@
 import de.ids_mannheim.korap.web.utils.FormRequestWrapper;
 import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.*;
 import javax.ws.rs.core.*;
@@ -37,10 +37,9 @@
 @ResourceFilters({ PiwikFilter.class })
 public class UserService {
 
-    private static Logger error = KustvaktLogger
-            .getLogger(KustvaktLogger.ERROR_LOG);
-    private static Logger jlog = KustvaktLogger
-            .getLogger(KustvaktLogger.SECURITY_LOG);
+    private static Logger jlog = LoggerFactory.getLogger(UserService.class);
+    //    private static Logger jlog = KustvaktLogger
+    //            .getLogger(KustvaktLogger.SECURITY_LOG);
     private AuthenticationManagerIface controller;
 
     private
@@ -60,8 +59,8 @@
     public Response signUp(
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
-            @Context Locale locale, MultivaluedMap form_values) {
-        Map<String, Object> wrapper = FormRequestWrapper
+            @Context Locale locale, MultivaluedMap<String, String> form_values) {
+        Map<String, String> wrapper = FormRequestWrapper
                 .toMap(form_values, true);
 
         wrapper.put(Attributes.HOST, host);
@@ -183,7 +182,7 @@
             builder.append(Attributes.QUERY_PARAM_USER).append("=")
                     .append(username);
         }catch (KustvaktException e) {
-            error.error("Eoxception encountered!", e);
+            jlog.error("Eoxception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -204,7 +203,7 @@
         try {
             controller.resetPassword(uri, username, passphrase);
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             return Response.notModified().build();
         }
         return Response.ok().build();
@@ -228,10 +227,8 @@
         }catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
-        Map m = Scopes.mapOpenIDConnectScopes(scopes, user.getDetails());
-        m.put("scopes", scopes);
-
-        return Response.ok(JsonUtils.toJSON(m)).build();
+        Scopes m = Scopes.mapScopes(scopes, user.getDetails());
+        return Response.ok(m.toEntity()).build();
     }
 
     @GET
@@ -247,7 +244,7 @@
             controller.getUserSettings(user);
 
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(JsonUtils.toJSON(user.getSettings().toObjectMap()))
@@ -261,9 +258,9 @@
     @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
             PiwikFilter.class })
     public Response updateSettings(@Context SecurityContext context,
-            @Context Locale locale, MultivaluedMap<String, Object> form) {
+            @Context Locale locale, MultivaluedMap<String, String> form) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
-        Map<String, Object> settings = FormRequestWrapper.toMap(form, false);
+        Map<String, String> settings = FormRequestWrapper.toMap(form, false);
 
         try {
             User user = controller.getUser(ctx.getUsername());
@@ -274,12 +271,13 @@
             //            SecurityManager.findbyId(us.getDefaultLemmafoundry(), user, Foundry.class);
             //            SecurityManager.findbyId(us.getDefaultPOSfoundry(), user, Foundry.class);
             //            SecurityManager.findbyId(us.getDefaultRelfoundry(), user, Foundry.class);
-            us.updateObjectSettings(settings);
+            us.updateStringSettings(settings);
+
             controller.updateUserSettings(user, us);
             if (user.isDemo())
                 return Response.notModified().build();
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -298,7 +296,7 @@
             user = controller.getUser(ctx.getUsername());
             controller.getUserDetails(user);
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -314,7 +312,7 @@
             @Context Locale locale, MultivaluedMap form) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
 
-        Map<String, Object> wrapper = FormRequestWrapper.toMap(form, true);
+        Map<String, String> wrapper = FormRequestWrapper.toMap(form, true);
 
         try {
             User user = controller.getUser(ctx.getUsername());
@@ -324,7 +322,7 @@
             if (user.isDemo())
                 return Response.notModified().build();
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -379,7 +377,7 @@
             //                        resources.toArray(new UserQuery[resources.size()]));
             //            }
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(JsonUtils.toJSON(add)).build();
@@ -396,7 +394,7 @@
                 return Response.notModified().build();
             controller.deleteAccount(user);
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok().build();
@@ -418,7 +416,7 @@
             //todo:
             queryStr = "";
         }catch (KustvaktException e) {
-            error.error("Exception encountered!", e);
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(queryStr).build();
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java b/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java
index 6a07ba3..b688ab0 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java
@@ -16,7 +16,7 @@
  */
 public class FormRequestWrapper extends HttpServletRequestWrapper {
 
-    private MultivaluedMap<String, Object> form;
+    private MultivaluedMap<String, String> form;
 
     /**
      * Constructs a request object wrapping the given request.
@@ -25,7 +25,7 @@
      * @throws IllegalArgumentException if the request is null
      */
     public FormRequestWrapper(HttpServletRequest request,
-            MultivaluedMap<String, Object> form) {
+            MultivaluedMap<String, String> form) {
         super(request);
         this.form = form;
     }
@@ -48,7 +48,7 @@
         return values;
     }
 
-    public Map<String, Object> singleValueMap() {
+    public Map<String, String> singleValueMap() {
         return toMap(this.form, false);
     }
 
@@ -57,13 +57,14 @@
      *               in value list and returns the result
      * @return key/value map
      */
-    public static Map<String, Object> toMap(MultivaluedMap<String, Object> form,
+    public static Map<String, String> toMap(MultivaluedMap<String, String> form,
             boolean strict) {
-        HashMap<String, Object> map = new HashMap<>();
+        HashMap<String, String> map = new HashMap<>();
         for (String key : form.keySet()) {
             if (strict && form.get(key).size() > 1)
                 continue;
             map.put(key, form.getFirst(key));
+
         }
         return map;
     }
@@ -73,7 +74,7 @@
     }
 
     public void put(String key, String... values) {
-        this.form.put(key, Arrays.<Object>asList(values));
+        this.form.put(key, Arrays.<String>asList(values));
     }
 
 }
diff --git a/src/main/resources/ehcache.xml b/src/main/resources/ehcache.xml
index 34f478c..4259339 100644
--- a/src/main/resources/ehcache.xml
+++ b/src/main/resources/ehcache.xml
@@ -2,6 +2,8 @@
          xsi:noNamespaceSchemaLocation='http://ehcache.org/ehcache.xsd'>
     <defaultCache eternal='true' overflowToDisk='false'/>
     <!--maxBytesLocalHeap="200M"-->
+    <diskStore path="./cache_store"/>
+
     <cache name="documents"
            timeToIdleSeconds="172800"
            eternal='false'
@@ -16,10 +18,19 @@
            overflowToDisk='false'/>
     <cache name='id_tokens'
            timeToIdleSeconds="172800"
-           eternal='false'
+           eternal='true'
+           maxElementsOnDisk="10000000"
            memoryStoreEvictionPolicy="LRU"
            maxEntriesLocalHeap="50"
-           overflowToDisk='false'/>
+           overflowToDisk='true'/>
+    <cache name='id_tokens_inv'
+           timeToIdleSeconds="322800"
+           eternal='true'
+           maxElementsOnDisk="10000000"
+           memoryStoreEvictionPolicy="LRU"
+           maxEntriesLocalHeap="50"
+           overflowToDisk='true'/>
+
     <cache name='auth_codes'
            timeToIdleSeconds="600"
            eternal='false'
diff --git a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
index b8e0973..925a350 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -1,12 +1,19 @@
 package de.ids_mannheim.korap.config;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.CollectionDao;
+import de.ids_mannheim.korap.resources.VirtualCollection;
+import de.ids_mannheim.korap.security.ac.ResourceFinder;
+import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.utils.ServiceVersion;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import org.junit.After;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 
+import java.util.Set;
+
 /**
  * @author hanl
  * @date 02/09/2015
@@ -18,10 +25,33 @@
         BeanConfiguration.closeApplication();
     }
 
-
-    @Test
+    @Before
     public void create() {
         BeanConfiguration.loadClasspathContext("default-config.xml");
+        //        PersistenceClient cl = BeanConfiguration.getBeans()
+        //                .getPersistenceClient();
+        //        Set<ResourceOperationIface> ifaces = new HashSet<>();
+        //        ifaces.add(new ResourceDao(cl));
+        //        ifaces.add(new CollectionDao(cl));
+        //
+        //        SecurityManager.setProviders(new PolicyDao(cl),
+        //                BeanConfiguration.getBeans().getEncryption(), ifaces);
+        //        ResourceFinder.setProviders(new PolicyDao(cl));
+        TestHelper.runBootInterfaces();
+    }
+
+    @Test
+    public void testCollectionLoader() throws KustvaktException {
+        CollectionDao dao = new CollectionDao(
+                BeanConfiguration.getBeans().getPersistenceClient());
+        int size = dao.size();
+        Assert.assertNotEquals("Is not supposed to be zero", size, 0);
+        Assert.assertEquals("wrong size", size, 3);
+
+        Set<VirtualCollection> set = ResourceFinder.search(User.UserFactory
+                        .toUser(KustvaktConfiguration.KUSTVAKT_USER),
+                VirtualCollection.class);
+        System.out.println("RESULTING SET: " + set);
     }
 
     @Test
diff --git a/src/test/java/de/ids_mannheim/korap/config/UserTestHelper.java b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
similarity index 65%
rename from src/test/java/de/ids_mannheim/korap/config/UserTestHelper.java
rename to src/test/java/de/ids_mannheim/korap/config/TestHelper.java
index 91bc3fe..2d599f1 100644
--- a/src/test/java/de/ids_mannheim/korap/config/UserTestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -5,6 +5,7 @@
 import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.web.service.BootupInterface;
 import org.junit.Assert;
 import org.springframework.jdbc.core.RowCallbackHandler;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
@@ -19,12 +20,12 @@
  * @author hanl
  * @date 16/10/2015
  */
-public class UserTestHelper {
+public class TestHelper {
 
     private static final String[] credentials = new String[] { "test1",
             "testPass2015" };
 
-    public static boolean setup() {
+    public static boolean setupUser() {
         boolean r = BeanConfiguration.hasContext();
         if (r) {
             EntityHandlerIface dao = BeanConfiguration.getBeans()
@@ -46,7 +47,7 @@
         return r;
     }
 
-    public static boolean drop() {
+    public static boolean dropUser() {
         boolean r = BeanConfiguration.hasContext();
         if (r) {
             EntityHandlerIface dao = BeanConfiguration.getBeans()
@@ -61,7 +62,7 @@
         return r;
     }
 
-    public static boolean truncateAll() {
+    public static boolean truncateAllUsers() {
         boolean r = BeanConfiguration.hasContext();
         if (r) {
             String sql = "SELECT Concat('TRUNCATE TABLE ', TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES";
@@ -85,11 +86,46 @@
         return r;
     }
 
-    public static final String[] getCredentials() {
+    public static final String[] getUserCredentials() {
         return Arrays.copyOf(credentials, 2);
     }
 
-    private UserTestHelper() {
+
+    public static void runBootInterfaces() {
+        Set<Class<? extends BootupInterface>> set = KustvaktClassLoader
+                .loadSubTypes(BootupInterface.class);
+
+        List<BootupInterface> list = new ArrayList<>(set.size());
+
+        PersistenceClient client = BeanConfiguration.getBeans()
+                .getPersistenceClient();
+        if (client.checkDatabase()) {
+            for (Class cl : set) {
+                BootupInterface iface;
+                try {
+                    iface = (BootupInterface) cl.newInstance();
+                    if (iface.position() == -1 | iface.position() > set.size())
+                        list.add(iface);
+                    else
+                        list.add(0, iface);
+                }catch (InstantiationException | IllegalAccessException e) {
+                    continue;
+                }
+            }
+            System.out.println("Found boot loading interfaces: " + list);
+            for (BootupInterface iface : list) {
+                try {
+                    iface.load();
+                }catch (KustvaktException e) {
+                    // don't do anything!
+                }
+            }
+        }
+    }
+
+
+
+    private TestHelper() {
     }
 
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
index f45108a..1356a58 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
@@ -3,10 +3,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.ClientResponse;
 import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.TestHelper;
 import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.web.KustvaktBaseServer;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -24,7 +24,7 @@
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
 
-        KustvaktBaseServer.runPreStart();
+        TestHelper.runBootInterfaces();
     }
 
     @AfterClass
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
index 0afd8ee..576eee0 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
@@ -3,7 +3,7 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.ClientResponse;
 import de.ids_mannheim.korap.config.BeanConfiguration;
-import de.ids_mannheim.korap.config.UserTestHelper;
+import de.ids_mannheim.korap.config.TestHelper;
 import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -21,7 +21,7 @@
 
     @AfterClass
     public static void close() {
-        UserTestHelper.drop();
+        TestHelper.dropUser();
         BeanConfiguration.closeApplication();
     }
 
@@ -32,8 +32,8 @@
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
 
-        UserTestHelper.setup();
-        credentials = UserTestHelper.getCredentials();
+        TestHelper.setupUser();
+        credentials = TestHelper.getUserCredentials();
     }
 
 //    @Test
