Fix a bunch of little bugs.