scattered minor bug fixes