Fix partial reads from pipe handling