Fixed various bugs and glitches.