Fix a few of many bugs.