miscellaneous bug fixes