catching EOF