Fix for infinitLoop glitch