correct eof and limit logic for stream copies