Small corrections in the bunch generation functions, and changed the
returned variables