fixing end of files