adding fixes to avoid glitches