Handle end of file correctly.
Fix bug: not response when startup sometimes.
Fix bug: wrong position of upper-left corner msg.