Fix a bunch of various issues.