diff --git a/src/communication/gathered_vector.hpp b/src/communication/gathered_vector.hpp
index cf48192f628b665713a25b2b1a53f0df3af86936..ceb5c16cde44a872e9ce08d3b4c65c58f9f73c1a 100644
--- a/src/communication/gathered_vector.hpp
+++ b/src/communication/gathered_vector.hpp
@@ -20,7 +20,7 @@ public:
         partition_(std::move(p))
     {
         EXPECTS(std::is_sorted(partition_.begin(), partition_.end()));
-        EXPECTS(std::size_t(partition_.back()) == v.size());
+        EXPECTS(std::size_t(partition_.back()) == values_.size());
     }
 
     /// the partition of distribution
diff --git a/src/communication/serial_global_policy.hpp b/src/communication/serial_global_policy.hpp
index 73d7b96b378da6880ea337f702cc13995d2f05ec..486266cadcacde9b9db4c7393efad9540a5c74f8 100644
--- a/src/communication/serial_global_policy.hpp
+++ b/src/communication/serial_global_policy.hpp
@@ -15,7 +15,11 @@ struct serial_global_policy {
     template <typename Spike>
     static gathered_vector<Spike>
     gather_spikes(const std::vector<Spike>& local_spikes) {
-        return gathered_vector<Spike>(std::vector<Spike>(local_spikes), {0u, 1u});
+        using count_type = typename gathered_vector<Spike>::count_type;
+        return gathered_vector<Spike>(
+            std::vector<Spike>(local_spikes),
+            {0u, static_cast<count_type>(local_spikes.size())}
+        );
     }
 
     static int id() {
diff --git a/src/util/range.hpp b/src/util/range.hpp
index 590bdb45d14433cd5642e9042b8adaeb4feb76f2..6bcb4c2567d79873cbaffb19f9ca642bb4bddc61 100644
--- a/src/util/range.hpp
+++ b/src/util/range.hpp
@@ -87,9 +87,9 @@ struct range {
         std::swap(right, other.right);
     }
 
-    decltype(*left) front() const { return *left; }
+    auto front() const -> decltype(*left) { return *left; }
 
-    decltype(*left) back() const { return *upto(left, right); }
+    auto back() const -> decltype(*left) { return *upto(left, right); }
 
     template <typename V = iterator>
     enable_if_t<is_random_access_iterator<V>::value, decltype(*left)>
@@ -200,7 +200,7 @@ public:
 
     // forward and input iterator requirements
 
-    auto operator*() const -> decltype(*iter()) { return *iter(); }
+    auto operator*() const -> decltype(*(this->iter())) { return *iter(); }
 
     I operator->() const { return e_.template ptr<0>(); }
 
@@ -271,7 +271,7 @@ public:
         return iter()-x.iter();
     }
 
-    auto operator[](difference_type n) const -> decltype(*iter()){
+    auto operator[](difference_type n) const -> decltype(*(this->iter())) {
         return *(iter()+n);
     }