Lots of glitch fixes