fixing several EOF errors