       int indx = threadIdx.x + blockIdx.x * blockDim.x;
       while (indx < d_num_active_synapses[0]) {
         int idx = d_active_synapses[indx];
-        if (idx < 0)
+        if (idx < 0){
+          indx += blockDim.x * gridDim.x;
           continue;
+        }
 
         float synaptic_conductance_g = d_synaptic_conductances_g[idx];
 

      int indx = threadIdx.x + blockIdx.x * blockDim.x;
      while (indx < d_num_active_synapses[0]) {
        int idx = d_active_synapses[indx];
        if (idx < 0)
          continue;
        //synapse_switches[indx] = d_active_synapses[indx];
        int timesteps_until_spike_reaches_synapse = d_spikes_travelling_to_synapse[idx];


      int indx = threadIdx.x + blockIdx.x * blockDim.x;
      while (indx < d_num_active_synapses[0]) {
        int idx = d_active_synapses[indx];
        if (idx < 0){
          indx += blockDim.x * gridDim.x;
          continue;
        }

        float reversal_potential_Vhat = d_reversal_potentials_Vhat[idx];
        int postsynaptic_neuron_index = d_postsynaptic_neuron_indices[idx];
