diff --git a/src/neuron_m.f90 b/src/neuron_m.f90
index d06505ac49fb3aa97ac0082e4b30abe762a1f096..bbe17e1c3d228459916ad13d5d356d69052775b4 100644
--- a/src/neuron_m.f90
+++ b/src/neuron_m.f90
@@ -354,6 +354,7 @@ module neuron_m
 #endif 
             this%potential = 0
             this%state     = 0  !TODO maybe init with values from normal distribution
+            this%id        = 1  !TODO modify - should be index in the whole set of neurons
 
 #ifdef TIME_PROFILING
             call time_profiling_stop(start_time, 'neuron_init_components_impl')
@@ -386,7 +387,6 @@ module neuron_m
             integer, intent(in)         :: unit
             integer, intent(out)        :: iostat
             character(*), intent(inout) :: iomsg
-            integer                     :: i !< Counter
 #ifdef TIME_PROFILING
             real                        :: start_time
             call time_profiling_start(start_time)
@@ -405,7 +405,6 @@ module neuron_m
             integer, intent(in)            :: unit
             integer, intent(out)           :: iostat
             character(*), intent(inout)    :: iomsg
-            integer                        :: i
 #ifdef TIME_PROFILING
             real                           :: start_time
             call time_profiling_start(start_time)
diff --git a/src/neuron_m_mem_leak_test.f90 b/src/neuron_m_mem_leak_test.f90
new file mode 100644
index 0000000000000000000000000000000000000000..2558f8017205efc6bcd9fa1718effdfda5605d85
--- /dev/null
+++ b/src/neuron_m_mem_leak_test.f90
@@ -0,0 +1,21 @@
+program neuron_m_mem_leak_test
+    use neuron_m
+
+    implicit none
+
+    type(linear_neuron_t) :: ln
+    type(linear_neuron_t), allocatable :: ln2
+    ln = linear_neuron_t()
+
+    allocate(ln2)
+
+    open(123,file='neuron.test', form='unformatted')
+        write(123) ln
+    close(123)
+
+    open(123,file='neuron.test', form='unformatted')
+        read(123) ln2
+    close(123)
+
+    write(*,*) ln2%get_potential(), ln2%get_state(), ln2%get_id()
+end program neuron_m_mem_leak_test