Add more error handling; survice EOF without EOL