remove memcopy, read directly into buffer