fixed rollover error on the delay call in the primary loop.