Fix a few bugs.