anchor.diff:                                              cdet, qs%psip_list%pops(ispace, idet), gen_excit_ptr, qs%trial%wfn_dat, &
                                               logging_info, nspawned, nspawned_im, connection)
                               ! If imaginary parent have to factor into resulting signs/reality.
  -                            if (imag) nspawned_im = -nspawned_im
  +                            if (imag) then
  +                                scratch = nspawned
  +                                nspawned = -nspawned_im
  +                                nspawned_im = scratch
  +                            end if
   
                               ! Spawn if attempt was successful.
                               if (nspawned /= 0_int_p) then
  +                                if (imag) then
  +                                    target_space = ispace - 1
  +                                else
  +                                    target_space = ispace
  +                                end if
                                   if (determ_parent) then
                                       call create_excited_det(sys%basis, cdet%f, connection, f_child)
                                       determ_child = check_if_determ(determ%hash_table, determ%dets, f_child)
  
positive.code:                             end if
                              if (nspawned_im /= 0_int_p) then
                                  if (imag) then
                                      target_space = ispace - 1
                                  else
                                      target_space = ispace + 1
                                  end if
  
negative.code:         real(dp), allocatable :: nparticles_old(:)
  
          integer(i0) :: f_child(sys%basis%string_len)
          integer(int_p) :: nspawned, nspawned_im, scratch
          integer(int_p) ::  ndeath, ndeath_im
          integer :: nattempts_current_det, nspawn_events, target_space
          type(excit_t) :: connection
  