Add block range check

This fix the bug:
--
a
b
[EOF]
---
Block Top=2, End=3
Delete Block
Block Top=1
Delete Block
-> Corrupt text