Fixed crash caused by C-d input (EOF)