Added fix from kgleeson to remove glitching