bugfix: ensure chunk_size divisble by typesize

Closes #18 if it is correct. But might need some more tests.

@dmbelov look ok to you?