fix issue #8

issue detail : if batch's elment number < batch number, the last group
batch maybe empty
Merge pull request #9 from jasonwbw/cython

fix issue #8