Fix MOTD end detection