Fixed a few code glitches