Fixed some more auto-formatting bugs and improved error tolerance.