sundry bug fixes