fix math, use floor
adjust size of last piece buffer
fix sapcing
Merge pull request #1 from bruslim/master

fix spacing, and fix the bug