a few unrelated bug fixes