handing EOT messages. changed run loop