Attempt lag fix

Attempt to fix lag by setting looping to true or false only when it is
the opposite.