add debug output
fix rounding for lower boundary too
fix issue #2