Fixed issue #22. The bug was integer division when computing the regulator