buffer: fix writing and slicing
fs: fix read length