diff --git a/accsoft-nxcals-service/src/main/java/cern/accsoft/nxcals/service/internal/InternalEntityServiceImpl.java b/accsoft-nxcals-service/src/main/java/cern/accsoft/nxcals/service/internal/InternalEntityServiceImpl.java
index 752655cc96ed5bdfa863b7948143311066820f00..c4e8467669e69237d3b7db9cd2c55312fa5844f7 100644
--- a/accsoft-nxcals-service/src/main/java/cern/accsoft/nxcals/service/internal/InternalEntityServiceImpl.java
+++ b/accsoft-nxcals-service/src/main/java/cern/accsoft/nxcals/service/internal/InternalEntityServiceImpl.java
@@ -289,11 +289,11 @@ public class InternalEntityServiceImpl extends BaseService implements InternalEn
 
     private Entity findEntityBySystemIdAndKeyValuesOrThrow(long systemId, Map<String, Object> keyValues) {
         String entityKeyDefinitions = findSystemOrThrowError(systemId).getEntityKeyDefs();
-        return entityRepository.findByPartitionSystemIdAndKeyValues(systemId,
-                convertMapIntoAvroSchemaString(keyValues, entityKeyDefinitions))
+        String stringKeyValues = convertMapIntoAvroSchemaString(keyValues, entityKeyDefinitions);
+        return entityRepository.findByPartitionSystemIdAndKeyValues(systemId,stringKeyValues)
                 .orElseThrow(() -> new NotFoundRuntimeException(
                         String.format("Entity of system with id %s and key values %s not found.", systemId,
-                                keyValues)));
+                                stringKeyValues)));
     }
 
     private System findSystemOrThrowError(long id) {