fixed EOF termination