diff --git a/python/example/single_cell_swc.py b/python/example/single_cell_swc.py
index 1cf996233d140f144fa119a4a79d230dd6cd66ea..e0ac637756fb2184b4d6fc00ae9aeebdb1e9eb1b 100644
--- a/python/example/single_cell_swc.py
+++ b/python/example/single_cell_swc.py
@@ -50,7 +50,7 @@ cell.place('stim_site', arbor.iclamp(8, 1, current=1))
 cell.place('root', arbor.spike_detector(-10))
 
 # Have one compartment between each sample point.
-cell.compartments_on_samples()
+cell.compartments_on_segments()
 
 # Make single cell model.
 m = arbor.single_cell_model(cell)
diff --git a/python/flat_cell_builder.cpp b/python/flat_cell_builder.cpp
index e201677389c864465f5f7c8e3d6dfb06ee5db345..56a0c65e0508b48f2777c8af50a2d296e41b285c 100644
--- a/python/flat_cell_builder.cpp
+++ b/python/flat_cell_builder.cpp
@@ -82,7 +82,7 @@ public:
 
         cable_distal_segs_.push_back(p);
 
-        return size()-1;
+        return cable_distal_segs_.size()-1;
     }
 
     void add_label(const char* name, const char* description) {