Fix a variety of small issues