Fix bugs

- A bug in computing the length of a generator is fixed. Now the code
  works.
- The default value for MC samples is changed to 2000.