Correct end of file behaviour