Only read the bytes needed

Fixes #3.