fix a variety of issues