Fix several loose ends