Fix reading when whitespace occurs at the end of a chunk
Use better test