diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java b/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java
index 12f817823d00..066d610920c0 100644
--- a/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java
+++ b/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java
@@ -68,7 +68,8 @@ public void setCaretPosition(int position) {
 
     @Override
     public Map<OffsetRange, ColoringAttributes> getOccurrences() {
-        return range2Attribs;
+        // must not return null
+        return Collections.unmodifiableMap(range2Attribs);
     }
 
     @Override
@@ -99,9 +100,11 @@ public void run(Result result, SchedulerEvent event) {
             return;
         }
 
-        if (!node.getBoolean(MarkOccurencesSettings.KEEP_MARKS, true) || localRange2Attribs.size() > 0) {
-            //store the occurrences if not empty, return null in getOccurrences() otherwise
+        if (!node.getBoolean(MarkOccurencesSettings.KEEP_MARKS, true) || !localRange2Attribs.isEmpty()) {
+            //store the occurrences if not empty
             range2Attribs = localRange2Attribs;
+        } else {
+            range2Attribs = Collections.emptyMap();
         }
     }