Fix a handful of bugs