diff --git a/src/cell_group.hpp b/src/cell_group.hpp
index 69a94a98fa3de23890b735a3d52a1c381c70322d..0143ce83d7ee40cc18d5b389d5501a1a2bdb80b0 100644
--- a/src/cell_group.hpp
+++ b/src/cell_group.hpp
@@ -42,10 +42,10 @@ public:
 
         source_id_type source_id={gid_base_,0};
         for (auto& d : c.detectors()) {
-            ++source_id.index;
             spike_sources_.push_back({
                 source_id, spike_detector_type(cell_, d.location, d.threshold, 0.f)
             });
+            ++source_id.index;
         }
     }
 
diff --git a/src/communication/communicator.hpp b/src/communication/communicator.hpp
index cefffd4cfd381c7d2350a2efd1c178d534b1ce1a..9336daebc2cda6f179a2ad59211d7b9927c38a38 100644
--- a/src/communication/communicator.hpp
+++ b/src/communication/communicator.hpp
@@ -5,12 +5,12 @@
 #include <vector>
 #include <random>
 
-#include <spike.hpp>
-#include <threading/threading.hpp>
 #include <algorithms.hpp>
+#include <connection.hpp>
 #include <event_queue.hpp>
-
-#include "connection.hpp"
+#include <spike.hpp>
+#include <threading/threading.hpp>
+#include <util/debug.hpp>
 
 namespace nest {
 namespace mc {
diff --git a/tests/unit/test_lexcmp.cpp b/tests/unit/test_lexcmp.cpp
index a02ac0765823f61d54e8acee3cf38611552d9dd7..e2b5c476d7983f7726349953d15e34509aab031c 100644
--- a/tests/unit/test_lexcmp.cpp
+++ b/tests/unit/test_lexcmp.cpp
@@ -62,8 +62,8 @@ class lexcmp_test_refmemfn {
 public:
     explicit lexcmp_test_refmemfn(int foo): foo_(foo) {}
 
-    const int &foo() const { return foo_; }
-    int &foo() { return foo_; }
+    const int& foo() const { return foo_; }
+    int& foo() { return foo_; }
 
 private:
     int foo_;