DC inversion failing

I am modifying the DC resistivity inversion script (with irls) to use my own data. Even though my data have been acquired with a Wenner-Schlumberger configuration, I was able to create a .obs file. Everything seems to work fine (after I adapted the mesh), but teh inversion apparently does not converge: after several iterations is gives me an error (singular factor). I shoudl really dig in, but if someone had an easy way-out, it would be appreciated. Thank you.
Let me know, and I will send the file and the script I am using (but it is just a sligtht modification of the original).