Add missing end of file check