Fix a bunch of stupid bugs.