Fix zero-length bug in read()