Fix up some bugs.